Version Description
- New: Filter hooks to override ability to edit document data
- Simple template: Only show shipping & payment method lines when set
- Security: escape urls as late as possible
- Fix: WP6.0+ converting interface elements to emojis
- Tweak: Show sticky save button for all setting changes
Download this release
Release Info
Developer | pomegranate |
Plugin | WooCommerce PDF Invoices & Packing Slips |
Version | 2.15.0 |
Comparing to | |
See all releases |
Code changes from version 2.14.5 to 2.15.0
- assets/css/settings-styles.css +25 -2
- assets/css/settings-styles.min.css +1 -1
- assets/js/admin-script.js +33 -45
- assets/js/admin-script.min.js +1 -1
- assets/js/confetti.min.js +1 -1
- includes/class-wcpdf-admin.php +25 -8
- includes/class-wcpdf-font-synchronizer.php +4 -4
- includes/class-wcpdf-frontend.php +3 -3
- includes/class-wcpdf-main.php +13 -13
- includes/class-wcpdf-settings-callbacks.php +6 -8
- includes/class-wcpdf-settings-documents.php +1 -1
- includes/class-wcpdf-settings-general.php +1 -1
- includes/class-wcpdf-settings.php +1 -1
- includes/class-wcpdf-setup-wizard.php +1 -1
- includes/compatibility/abstract-wc-data-compatibility.php +4 -4
- includes/documents/abstract-wcpdf-order-document-methods.php +3 -3
- includes/documents/abstract-wcpdf-order-document.php +3 -3
- includes/documents/class-wcpdf-bulk-document.php +2 -2
- includes/documents/class-wcpdf-invoice.php +1 -1
- includes/views/attachment-settings-hint.php +3 -3
- includes/views/wcpdf-settings-page.php +2 -2
- includes/wcpdf-functions.php +1 -1
- readme.txt +8 -1
- templates/Simple/invoice.php +3 -1
- templates/Simple/packing-slip.php +3 -1
- woocommerce-pdf-invoices-packingslips.php +6 -6
assets/css/settings-styles.css
CHANGED
@@ -749,13 +749,35 @@ body.woocommerce_page_wpo_wcpdf_options_page {
|
|
749 |
display: none;
|
750 |
}
|
751 |
|
752 |
-
#wpo-wcpdf-preview-wrapper .
|
753 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
754 |
}
|
755 |
|
756 |
#wpo-wcpdf-preview-wrapper .slider.slide-left:after {
|
757 |
content: 'Preview';
|
758 |
position: absolute;
|
|
|
759 |
right: 2em;
|
760 |
font-size: 1.4em;
|
761 |
display: none;
|
@@ -764,6 +786,7 @@ body.woocommerce_page_wpo_wcpdf_options_page {
|
|
764 |
#wpo-wcpdf-preview-wrapper .slider.slide-right:after {
|
765 |
content: 'Settings';
|
766 |
position: absolute;
|
|
|
767 |
left: 2em;
|
768 |
font-size: 1.4em;
|
769 |
display: none;
|
749 |
display: none;
|
750 |
}
|
751 |
|
752 |
+
#wpo-wcpdf-preview-wrapper .gutter-arrow {
|
753 |
+
width: 0;
|
754 |
+
height: 0;
|
755 |
+
border-top: 3px solid transparent;
|
756 |
+
border-bottom: 3px solid transparent;
|
757 |
+
display: block;
|
758 |
+
}
|
759 |
+
|
760 |
+
#wpo-wcpdf-preview-wrapper .arrow-left {
|
761 |
+
border-right: 7px solid #999;
|
762 |
+
float: right;
|
763 |
+
}
|
764 |
+
|
765 |
+
#wpo-wcpdf-preview-wrapper .arrow-right {
|
766 |
+
border-left: 7px solid #999;
|
767 |
+
}
|
768 |
+
|
769 |
+
#wpo-wcpdf-preview-wrapper .slider:hover > .arrow-left {
|
770 |
+
border-right: 7px solid #222;
|
771 |
+
}
|
772 |
+
|
773 |
+
#wpo-wcpdf-preview-wrapper .slider:hover > .arrow-right {
|
774 |
+
border-left: 7px solid #222;
|
775 |
}
|
776 |
|
777 |
#wpo-wcpdf-preview-wrapper .slider.slide-left:after {
|
778 |
content: 'Preview';
|
779 |
position: absolute;
|
780 |
+
top: 1.55em;
|
781 |
right: 2em;
|
782 |
font-size: 1.4em;
|
783 |
display: none;
|
786 |
#wpo-wcpdf-preview-wrapper .slider.slide-right:after {
|
787 |
content: 'Settings';
|
788 |
position: absolute;
|
789 |
+
top: 1.55em;
|
790 |
left: 2em;
|
791 |
font-size: 1.4em;
|
792 |
display: none;
|
assets/css/settings-styles.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
span.wpo-warning{display:inline-block;border:1px solid red;border-left:4px solid red;padding:5px 15px;background-color:#fff}.wcpdf-extensions-ad{position:relative;min-height:90px;border:1px solid #3d5c99;background-color:#ebf5ff;padding:15px;padding-left:100px;margin-top:15px}img.wpo-helper{position:absolute;bottom:0;left:3px}.wcpdf-extensions-ad h3{margin:0}.wcpdf-extensions-ad ul{margin:0;margin-left:1.5em}.wcpdf-extensions li{margin:0}.wcpdf-extensions li ul{list-style-type:square;margin-top:.5em;margin-bottom:.5em}.wcpdf-extensions>li:before{content:"";border-color:transparent transparent transparent #111;border-style:solid;border-width:.35em .35em .35em .45em;display:block;height:0;width:0;left:-1em;top:.9em;position:relative}.wcpdf-extensions li:not(.expanded){cursor:pointer}.wcpdf-extensions .expanded:before{border-color:#111 transparent transparent transparent;left:-1.17em;border-width:.45em .45em .35em .35em!important}.wcpdf-extensions .more{padding:10px;background-color:#fff;border:1px solid #ccc;border-radius:5px}.wcpdf-extensions table td{vertical-align:top}.dropbox-logo{margin-bottom:-10px;margin-right:10px}.cloud-logo{margin-bottom:-10px;margin-top:-5px;margin-right:10px}#img-header_logo{max-height:200px;width:auto;max-width:100%}.multiple-text-input label{min-width:120px;display:inline-block}table.wcpdf_documents_settings_list{width:100%;border-collapse:collapse;border-spacing:0;background-color:#fff;border-top:2px solid #000}table.wcpdf_documents_settings_list tr.odd{background-color:#ebf5ff}table.wcpdf_documents_settings_list td{padding:5px}table.wcpdf_documents_settings_list a{text-decoration:none}table.wcpdf_documents_settings_list td.settings-icon{text-align:right}table.wcpdf_documents_settings_list td.title{font-weight:700}.wcpdf-settings-sections ul{height:3em}.wcpdf-settings-sections ul li{float:left;margin-right:10px}.wcpdf-settings-sections ul li a{text-decoration:none;display:inline-block;padding:.8em 1em;color:#50575e;border:1px solid #c3c4c7;box-sizing:border-box}.wcpdf-settings-sections ul li a.active{border:2px solid #51266b;padding:calc(.8em - 1px) calc(1em - 1px);color:#000}.wcpdf_document_settings_sections{margin-bottom:40px;position:relative}.wcpdf_document_settings_sections>h2{cursor:pointer;padding:1em .8em;margin:0;border:1px solid #eaeaea}.wcpdf_document_settings_sections ul{background:#fff;list-style:none;margin:0;padding:0;width:100%;display:block;height:auto;display:none;box-sizing:border-box;position:absolute;border-left:1px solid #eaeaea;border-right:1px solid #eaeaea;z-index:1000;box-shadow:0 35px 35px -8px rgba(0,0,0,.1);-webkit-box-shadow:0 35px 35px -8px rgba(0,0,0,.1)}.wcpdf_document_settings_sections ul.active{display:block}.wcpdf_document_settings_sections ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.wcpdf_document_settings_sections ul li:hover{cursor:pointer;background:#51266b;color:#fff}.wcpdf_document_settings_sections ul li:hover a{color:#fff}.wcpdf_document_settings_sections ul li a{color:#000;text-decoration:none;padding:1.2em 1.6em;display:block}.wcpdf_document_settings_sections .arrow-down{font-size:.7em;color:#999;margin-left:8px;font-weight:400;float:right}.wcpdf_document_settings_sections p:hover,.wcpdf_document_settings_sections p:hover>.arrow-down{color:#222}.edit-next-number{opacity:.5}.edit-next-number:hover{opacity:1;cursor:pointer}body.woocommerce_page_wpo_wcpdf_options_page{background:#fff}.wrap [class$=icon32]+h2{font-size:18px;padding:1em}.wrap .notice{margin:15px 0 0}.nav-tab-wrapper a.nav-tab{background:0 0;border:none;border-bottom:3px solid transparent;padding:1em 0;margin:0 1.2em;font-size:15px}.nav-tab-wrapper a.nav-tab.nav-tab-active{border-bottom:3px solid #51266b}#wpo-wcpdf-preview-wrapper{width:100%;height:auto;position:relative;display:flex;align-items:flex-start}#wpo-wcpdf-preview-wrapper .preview-document,#wpo-wcpdf-preview-wrapper .sidebar{transition:.3s ease-in-out}#wpo-wcpdf-preview-wrapper .sidebar{height:auto;padding:4em 0 0 0;box-sizing:border-box;background:0 0;flex:0 0 35%;overflow-x:hidden}#wpo-wcpdf-preview-wrapper .sidebar>form{background:#fff;overflow:visible;padding:0;margin-left:2em;box-sizing:border-box;width:calc(100% - 4em);max-width:50vw}#wpo-wcpdf-preview-wrapper .sidebar>form.editor{max-width:none}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block;width:100%;padding:0}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{padding-bottom:.6em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td{padding-bottom:2.4em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td p.description,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>p.description{font-size:.85em;padding-top:.7em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>textarea,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>textarea{max-width:none;width:100%}#wpo-wcpdf-preview-wrapper input[type=text][size]{width:auto!important;max-width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input#next_invoice_number{width:auto!important}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table{display:table}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody{display:table-row-group}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tr{display:table-row}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{display:table-cell;padding:15px 10px 15px 0;width:auto}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{width:300px!important}#wpo-wcpdf-settings .form-table .ui-tabs-nav{padding-left:0!important;margin-left:0!important}#wpo-wcpdf-settings .translations input,#wpo-wcpdf-settings .translations textarea{width:100%}#wpo-wcpdf-settings .wcpdf-attachment-settings-hint{border-left:4px solid #51266b}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar{flex:0 0 100%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .sidebar{flex:0 0 95%;margin-left:-95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .sidebar{flex:0 0 35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .sidebar{margin-left:-35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .sidebar{transition-delay:.4s}#wpo-wcpdf-preview-wrapper .preview-document{padding:0;box-sizing:border-box;position:sticky;top:2.4em;flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .preview-document{flex:0 0 60%;margin-right:-60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .preview-document{flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .preview-document{transition-delay:.4s}.preview-document .preview{width:100%;box-sizing:border-box;padding-right:5%}.preview-document .preview>#preview-canvas{display:block;max-width:800px;max-height:85vh;width:auto!important;margin:0 auto;background:#fff;box-shadow:0 0 35px -8px rgba(0,0,0,.12);-webkit-box-shadow:0 0 35px -8px rgba(0,0,0,.12)}#wpo-wcpdf-preview-wrapper[data-preview-states="2"] #preview-canvas{max-height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=sidebar] #preview-canvas{max-height:170vh;transition:max-height .4s ease-in-out .3s}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] #preview-canvas{transition:max-height .4s ease-in-out 0s}.preview-document .preview-data-wrapper{width:100%;height:4em}.preview-document .preview-data-wrapper .preview-document-type,.preview-document .preview-data-wrapper .preview-order-data{float:right}.preview-document .preview-data-wrapper .preview-document-type{margin-right:30px}.preview-document .preview-data-wrapper .preview-document-type ul>li{text-decoration:none;color:initial;padding:1.4em 1.6em}.preview-document .preview-data-wrapper .preview-document-type ul>li:hover{color:#fff!important}.preview-document .preview-data-wrapper .save-settings{padding:1em 0 0 0;float:right;overflow:hidden;position:relative}.preview-document .preview-data-wrapper .save-settings p{padding:0;margin:0 0 0 2em;position:relative;margin-right:-200px;transition:margin-right .3s ease-out}.preview-document .preview-data-wrapper .save-settings p:after{content:'';display:block;pointer-events:none;position:absolute;box-sizing:border-box;border-radius:3px;right:0;top:0;background:0 0;width:100%;height:100%;z-index:10;border:0 solid #fff;animation:border-pulse 4s infinite}@keyframes border-pulse{0%{border-color:rgba(255,255,255,0);border-width:8px}50%{border-color:#fff;border-width:0}}.preview-document .preview-data-wrapper .save-settings p input:focus{outline-width:0;box-shadow:none}.preview-document .preview-data p{padding:1.4em 0;margin:0;color:#666;text-align:right;cursor:pointer;font-weight:lighter;float:right}.preview-document .preview-data p.order-search{display:none}.preview-document .preview-data input{float:right;margin:1em 0 0 1em;padding:.1em .5em;width:20ch;margin-right:-25ch;display:none}.preview-document .preview-data input.active{margin-right:0;display:inline-block}.preview-document .preview-data ul{position:absolute;right:0;top:4em;background:#fff;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);list-style:none;margin:0;padding:0;min-width:24em;display:block;height:0;overflow:hidden}.preview-document .preview-data ul.active{height:auto;z-index:1}.preview-document .preview-data ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.preview-document .preview-data ul li:hover{cursor:pointer;background:#51266b;color:#fff}.preview-document .preview-data ul li a,.preview-document .preview-data.preview-order-data ul li{display:block;padding:1.4em 1.6em}.preview-document .preview-data .arrow-down{font-size:.8em;color:#999;margin-left:8px}.preview-document .preview-data p:hover,.preview-document .preview-data p:hover>.arrow-down{color:#222}.preview-document .preview-data #preview-order-search-results{display:none;position:absolute;right:0;top:4em;width:300px;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);padding:20px 0;background-color:#fff}.preview-document .preview-data #preview-order-search-results a{display:block;border-left:1px solid #999;border-right:1px solid #999;border-top:1px solid #999;color:#000;padding:10px;margin:0 20px;text-decoration:none;cursor:pointer}.preview-document .preview-data #preview-order-search-results a:last-child{border-bottom:1px solid #999}.preview-document .preview-data #preview-order-search-results a:hover{background-color:#51266b;color:#fff}.preview-document .preview-data #preview-order-search-results .order-number{font-weight:700}.preview-document .preview-data #preview-order-search-results .date,.preview-document .preview-data #preview-order-search-results .total{margin-top:6px;display:inline-block}.preview-document .preview-data #preview-order-search-results .total{float:right}.preview-document .preview-data #preview-order-search-results .error{margin:0 20px}.preview-document .preview-order-search-wrapper{position:relative;float:right}.preview-document .preview-order-search-wrapper img.preview-order-search-clear{position:absolute;width:30px;height:16px;top:22px;right:6px;display:none;cursor:pointer}#wpo-wcpdf-preview-wrapper .gutter{flex:0 0 5%;position:sticky;top:2.4em;height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .gutter .slide-left,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .gutter .slide-left{float:right}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter .slide-left{border:none}#wpo-wcpdf-preview-wrapper .slider{box-sizing:border-box;padding-top:2.4em;color:#999;font-weight:700;cursor:pointer;font-size:.7em;line-height:1em;width:50%;height:100%;float:left}#wpo-wcpdf-preview-wrapper .slider.slide-left{text-align:right;padding-right:10px;border-right:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right{text-align:left;padding-left:10px;border-left:1px solid #ccc;display:none}#wpo-wcpdf-preview-wrapper .slider:hover{color:#222}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{content:'Preview';position:absolute;right:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{content:'Settings';position:absolute;left:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .gutter{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter{height:100vh}#wpo-wcpdf-preview-wrapper[data-preview-state=full] .slide-right:after{display:inline-block}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .slide-left:after{display:inline-block}#wpo-wcpdf-preview-wrapper.static .gutter,#wpo-wcpdf-preview-wrapper.static .preview-document{position:static!important}#wpo-wcpdf-preview-wrapper.static .sidebar{height:170vh!important;overflow:hidden}#wpo-wcpdf-preview-wrapper input.readonly,#wpo-wcpdf-preview-wrapper input[readonly],#wpo-wcpdf-preview-wrapper textarea.readonly,#wpo-wcpdf-preview-wrapper textarea[readonly]{background-color:#f8f8f8}#wpo-wcpdf-preview-wrapper[data-preview-state=sidebar] .select2.select2-container{width:100%!important}@media screen and (min-width:1920px){.preview-document .preview>#preview-canvas{max-width:900px}}@media screen and (max-width:1200px){.preview-document .preview>#preview-canvas{max-width:680px}.nav-tab-wrapper a.nav-tab{padding:1em 2em;margin:0 .5em .5em 0;border:1px solid #ccc;box-sizing:border-box;height:4em}.nav-tab-wrapper a.nav-tab.nav-tab-active{border:3px solid #51266b}}@media screen and (max-width:960px){.preview-document .preview>#preview-canvas{width:80vw!important}#wpo-wcpdf-preview-wrapper .sidebar>form{max-width:100%}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .select2.select2-container{width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block!important}.preview-document .preview-data-wrapper{height:6em}.preview-document .preview-data p{padding:2.2em 0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after,#wpo-wcpdf-preview-wrapper .slider.slide-right:after{top:1.5em;padding:1em;background:#fff;border:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{left:0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{right:0}}
|
1 |
+
span.wpo-warning{display:inline-block;border:1px solid red;border-left:4px solid red;padding:5px 15px;background-color:#fff}.wcpdf-extensions-ad{position:relative;min-height:90px;border:1px solid #3d5c99;background-color:#ebf5ff;padding:15px;padding-left:100px;margin-top:15px}img.wpo-helper{position:absolute;bottom:0;left:3px}.wcpdf-extensions-ad h3{margin:0}.wcpdf-extensions-ad ul{margin:0;margin-left:1.5em}.wcpdf-extensions li{margin:0}.wcpdf-extensions li ul{list-style-type:square;margin-top:.5em;margin-bottom:.5em}.wcpdf-extensions>li:before{content:"";border-color:transparent transparent transparent #111;border-style:solid;border-width:.35em .35em .35em .45em;display:block;height:0;width:0;left:-1em;top:.9em;position:relative}.wcpdf-extensions li:not(.expanded){cursor:pointer}.wcpdf-extensions .expanded:before{border-color:#111 transparent transparent transparent;left:-1.17em;border-width:.45em .45em .35em .35em!important}.wcpdf-extensions .more{padding:10px;background-color:#fff;border:1px solid #ccc;border-radius:5px}.wcpdf-extensions table td{vertical-align:top}.dropbox-logo{margin-bottom:-10px;margin-right:10px}.cloud-logo{margin-bottom:-10px;margin-top:-5px;margin-right:10px}#img-header_logo{max-height:200px;width:auto;max-width:100%}.multiple-text-input label{min-width:120px;display:inline-block}table.wcpdf_documents_settings_list{width:100%;border-collapse:collapse;border-spacing:0;background-color:#fff;border-top:2px solid #000}table.wcpdf_documents_settings_list tr.odd{background-color:#ebf5ff}table.wcpdf_documents_settings_list td{padding:5px}table.wcpdf_documents_settings_list a{text-decoration:none}table.wcpdf_documents_settings_list td.settings-icon{text-align:right}table.wcpdf_documents_settings_list td.title{font-weight:700}.wcpdf-settings-sections ul{height:3em}.wcpdf-settings-sections ul li{float:left;margin-right:10px}.wcpdf-settings-sections ul li a{text-decoration:none;display:inline-block;padding:.8em 1em;color:#50575e;border:1px solid #c3c4c7;box-sizing:border-box}.wcpdf-settings-sections ul li a.active{border:2px solid #51266b;padding:calc(.8em - 1px) calc(1em - 1px);color:#000}.wcpdf_document_settings_sections{margin-bottom:40px;position:relative}.wcpdf_document_settings_sections>h2{cursor:pointer;padding:1em .8em;margin:0;border:1px solid #eaeaea}.wcpdf_document_settings_sections ul{background:#fff;list-style:none;margin:0;padding:0;width:100%;display:block;height:auto;display:none;box-sizing:border-box;position:absolute;border-left:1px solid #eaeaea;border-right:1px solid #eaeaea;z-index:1000;box-shadow:0 35px 35px -8px rgba(0,0,0,.1);-webkit-box-shadow:0 35px 35px -8px rgba(0,0,0,.1)}.wcpdf_document_settings_sections ul.active{display:block}.wcpdf_document_settings_sections ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.wcpdf_document_settings_sections ul li:hover{cursor:pointer;background:#51266b;color:#fff}.wcpdf_document_settings_sections ul li:hover a{color:#fff}.wcpdf_document_settings_sections ul li a{color:#000;text-decoration:none;padding:1.2em 1.6em;display:block}.wcpdf_document_settings_sections .arrow-down{font-size:.7em;color:#999;margin-left:8px;font-weight:400;float:right}.wcpdf_document_settings_sections p:hover,.wcpdf_document_settings_sections p:hover>.arrow-down{color:#222}.edit-next-number{opacity:.5}.edit-next-number:hover{opacity:1;cursor:pointer}body.woocommerce_page_wpo_wcpdf_options_page{background:#fff}.wrap [class$=icon32]+h2{font-size:18px;padding:1em}.wrap .notice{margin:15px 0 0}.nav-tab-wrapper a.nav-tab{background:0 0;border:none;border-bottom:3px solid transparent;padding:1em 0;margin:0 1.2em;font-size:15px}.nav-tab-wrapper a.nav-tab.nav-tab-active{border-bottom:3px solid #51266b}#wpo-wcpdf-preview-wrapper{width:100%;height:auto;position:relative;display:flex;align-items:flex-start}#wpo-wcpdf-preview-wrapper .preview-document,#wpo-wcpdf-preview-wrapper .sidebar{transition:.3s ease-in-out}#wpo-wcpdf-preview-wrapper .sidebar{height:auto;padding:4em 0 0 0;box-sizing:border-box;background:0 0;flex:0 0 35%;overflow-x:hidden}#wpo-wcpdf-preview-wrapper .sidebar>form{background:#fff;overflow:visible;padding:0;margin-left:2em;box-sizing:border-box;width:calc(100% - 4em);max-width:50vw}#wpo-wcpdf-preview-wrapper .sidebar>form.editor{max-width:none}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block;width:100%;padding:0}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{padding-bottom:.6em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td{padding-bottom:2.4em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td p.description,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>p.description{font-size:.85em;padding-top:.7em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>textarea,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>textarea{max-width:none;width:100%}#wpo-wcpdf-preview-wrapper input[type=text][size]{width:auto!important;max-width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input#next_invoice_number{width:auto!important}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table{display:table}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody{display:table-row-group}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tr{display:table-row}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{display:table-cell;padding:15px 10px 15px 0;width:auto}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{width:300px!important}#wpo-wcpdf-settings .form-table .ui-tabs-nav{padding-left:0!important;margin-left:0!important}#wpo-wcpdf-settings .translations input,#wpo-wcpdf-settings .translations textarea{width:100%}#wpo-wcpdf-settings .wcpdf-attachment-settings-hint{border-left:4px solid #51266b}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar{flex:0 0 100%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .sidebar{flex:0 0 95%;margin-left:-95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .sidebar{flex:0 0 35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .sidebar{margin-left:-35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .sidebar{transition-delay:.4s}#wpo-wcpdf-preview-wrapper .preview-document{padding:0;box-sizing:border-box;position:sticky;top:2.4em;flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .preview-document{flex:0 0 60%;margin-right:-60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .preview-document{flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .preview-document{transition-delay:.4s}.preview-document .preview{width:100%;box-sizing:border-box;padding-right:5%}.preview-document .preview>#preview-canvas{display:block;max-width:800px;max-height:85vh;width:auto!important;margin:0 auto;background:#fff;box-shadow:0 0 35px -8px rgba(0,0,0,.12);-webkit-box-shadow:0 0 35px -8px rgba(0,0,0,.12)}#wpo-wcpdf-preview-wrapper[data-preview-states="2"] #preview-canvas{max-height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=sidebar] #preview-canvas{max-height:170vh;transition:max-height .4s ease-in-out .3s}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] #preview-canvas{transition:max-height .4s ease-in-out 0s}.preview-document .preview-data-wrapper{width:100%;height:4em}.preview-document .preview-data-wrapper .preview-document-type,.preview-document .preview-data-wrapper .preview-order-data{float:right}.preview-document .preview-data-wrapper .preview-document-type{margin-right:30px}.preview-document .preview-data-wrapper .preview-document-type ul>li{text-decoration:none;color:initial;padding:1.4em 1.6em}.preview-document .preview-data-wrapper .preview-document-type ul>li:hover{color:#fff!important}.preview-document .preview-data-wrapper .save-settings{padding:1em 0 0 0;float:right;overflow:hidden;position:relative}.preview-document .preview-data-wrapper .save-settings p{padding:0;margin:0 0 0 2em;position:relative;margin-right:-200px;transition:margin-right .3s ease-out}.preview-document .preview-data-wrapper .save-settings p:after{content:'';display:block;pointer-events:none;position:absolute;box-sizing:border-box;border-radius:3px;right:0;top:0;background:0 0;width:100%;height:100%;z-index:10;border:0 solid #fff;animation:border-pulse 4s infinite}@keyframes border-pulse{0%{border-color:rgba(255,255,255,0);border-width:8px}50%{border-color:#fff;border-width:0}}.preview-document .preview-data-wrapper .save-settings p input:focus{outline-width:0;box-shadow:none}.preview-document .preview-data p{padding:1.4em 0;margin:0;color:#666;text-align:right;cursor:pointer;font-weight:lighter;float:right}.preview-document .preview-data p.order-search{display:none}.preview-document .preview-data input{float:right;margin:1em 0 0 1em;padding:.1em .5em;width:20ch;margin-right:-25ch;display:none}.preview-document .preview-data input.active{margin-right:0;display:inline-block}.preview-document .preview-data ul{position:absolute;right:0;top:4em;background:#fff;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);list-style:none;margin:0;padding:0;min-width:24em;display:block;height:0;overflow:hidden}.preview-document .preview-data ul.active{height:auto;z-index:1}.preview-document .preview-data ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.preview-document .preview-data ul li:hover{cursor:pointer;background:#51266b;color:#fff}.preview-document .preview-data ul li a,.preview-document .preview-data.preview-order-data ul li{display:block;padding:1.4em 1.6em}.preview-document .preview-data .arrow-down{font-size:.8em;color:#999;margin-left:8px}.preview-document .preview-data p:hover,.preview-document .preview-data p:hover>.arrow-down{color:#222}.preview-document .preview-data #preview-order-search-results{display:none;position:absolute;right:0;top:4em;width:300px;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);padding:20px 0;background-color:#fff}.preview-document .preview-data #preview-order-search-results a{display:block;border-left:1px solid #999;border-right:1px solid #999;border-top:1px solid #999;color:#000;padding:10px;margin:0 20px;text-decoration:none;cursor:pointer}.preview-document .preview-data #preview-order-search-results a:last-child{border-bottom:1px solid #999}.preview-document .preview-data #preview-order-search-results a:hover{background-color:#51266b;color:#fff}.preview-document .preview-data #preview-order-search-results .order-number{font-weight:700}.preview-document .preview-data #preview-order-search-results .date,.preview-document .preview-data #preview-order-search-results .total{margin-top:6px;display:inline-block}.preview-document .preview-data #preview-order-search-results .total{float:right}.preview-document .preview-data #preview-order-search-results .error{margin:0 20px}.preview-document .preview-order-search-wrapper{position:relative;float:right}.preview-document .preview-order-search-wrapper img.preview-order-search-clear{position:absolute;width:30px;height:16px;top:22px;right:6px;display:none;cursor:pointer}#wpo-wcpdf-preview-wrapper .gutter{flex:0 0 5%;position:sticky;top:2.4em;height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .gutter .slide-left,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .gutter .slide-left{float:right}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter .slide-left{border:none}#wpo-wcpdf-preview-wrapper .slider{box-sizing:border-box;padding-top:2.4em;color:#999;font-weight:700;cursor:pointer;font-size:.7em;line-height:1em;width:50%;height:100%;float:left}#wpo-wcpdf-preview-wrapper .slider.slide-left{text-align:right;padding-right:10px;border-right:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right{text-align:left;padding-left:10px;border-left:1px solid #ccc;display:none}#wpo-wcpdf-preview-wrapper .gutter-arrow{width:0;height:0;border-top:3px solid transparent;border-bottom:3px solid transparent;display:block}#wpo-wcpdf-preview-wrapper .arrow-left{border-right:7px solid #999;float:right}#wpo-wcpdf-preview-wrapper .arrow-right{border-left:7px solid #999}#wpo-wcpdf-preview-wrapper .slider:hover>.arrow-left{border-right:7px solid #222}#wpo-wcpdf-preview-wrapper .slider:hover>.arrow-right{border-left:7px solid #222}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{content:'Preview';position:absolute;top:1.55em;right:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{content:'Settings';position:absolute;top:1.55em;left:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .gutter{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter{height:100vh}#wpo-wcpdf-preview-wrapper[data-preview-state=full] .slide-right:after{display:inline-block}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .slide-left:after{display:inline-block}#wpo-wcpdf-preview-wrapper.static .gutter,#wpo-wcpdf-preview-wrapper.static .preview-document{position:static!important}#wpo-wcpdf-preview-wrapper.static .sidebar{height:170vh!important;overflow:hidden}#wpo-wcpdf-preview-wrapper input.readonly,#wpo-wcpdf-preview-wrapper input[readonly],#wpo-wcpdf-preview-wrapper textarea.readonly,#wpo-wcpdf-preview-wrapper textarea[readonly]{background-color:#f8f8f8}#wpo-wcpdf-preview-wrapper[data-preview-state=sidebar] .select2.select2-container{width:100%!important}@media screen and (min-width:1920px){.preview-document .preview>#preview-canvas{max-width:900px}}@media screen and (max-width:1200px){.preview-document .preview>#preview-canvas{max-width:680px}.nav-tab-wrapper a.nav-tab{padding:1em 2em;margin:0 .5em .5em 0;border:1px solid #ccc;box-sizing:border-box;height:4em}.nav-tab-wrapper a.nav-tab.nav-tab-active{border:3px solid #51266b}}@media screen and (max-width:960px){.preview-document .preview>#preview-canvas{width:80vw!important}#wpo-wcpdf-preview-wrapper .sidebar>form{max-width:100%}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .select2.select2-container{width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block!important}.preview-document .preview-data-wrapper{height:6em}.preview-document .preview-data p{padding:2.2em 0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after,#wpo-wcpdf-preview-wrapper .slider.slide-right:after{top:1.5em;padding:1em;background:#fff;border:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{left:0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{right:0}}
|
assets/js/admin-script.js
CHANGED
@@ -242,50 +242,10 @@ jQuery( function( $ ) {
|
|
242 |
// Preview on page load
|
243 |
$( document ).ready( triggerPreview() );
|
244 |
|
245 |
-
// Preview on user input
|
246 |
-
$( document ).on( 'keyup paste', '#wpo-wcpdf-settings input:not([type=checkbox]), #wpo-wcpdf-settings textarea, #wpo-wcpdf-settings select:not(.dropdown-add-field)', function( event ) {
|
247 |
-
if ( ! settingIsExcludedForPreview( $( this ).attr( 'name' ) ) ) {
|
248 |
-
let previewDelay = event.type == 'keyup' ? 1000 : 0;
|
249 |
-
settingsChanged( previewDelay );
|
250 |
-
}
|
251 |
-
} );
|
252 |
-
|
253 |
-
// Preview on user selected option (using 'change' event breaks the PDF render)
|
254 |
-
$( document ).on( 'click', '#wpo-wcpdf-settings select:not(.dropdown-add-field) option', function( event ) {
|
255 |
-
if ( ! settingIsExcludedForPreview( $( this ).parent().attr( 'name' ) ) ) {
|
256 |
-
settingsChanged();
|
257 |
-
}
|
258 |
-
} );
|
259 |
-
|
260 |
-
// Preview on user checkbox change
|
261 |
-
$( document ).on( 'change', '#wpo-wcpdf-settings input[type="checkbox"]', function( event ) {
|
262 |
-
if ( ! settingIsExcludedForPreview( $( this ).attr( 'name' ) ) ) {
|
263 |
-
if ( ! event.isTrigger ) { // exclude programmatic triggers that aren't actually changing anything
|
264 |
-
settingsChanged( 1000 );
|
265 |
-
}
|
266 |
-
}
|
267 |
-
} );
|
268 |
-
|
269 |
-
// Preview on select / radio setting change
|
270 |
-
$( document ).on( 'change', '#wpo-wcpdf-settings input[type="radio"], #wpo-wcpdf-settings select', function( event ) {
|
271 |
-
if ( ! settingIsExcludedForPreview( $( this ).attr( 'name' ) ) ) {
|
272 |
-
if ( ! event.isTrigger ) { // exclude programmatic triggers that aren't actually changing anything
|
273 |
-
settingsChanged();
|
274 |
-
}
|
275 |
-
}
|
276 |
-
} );
|
277 |
-
|
278 |
-
// Preview on header logo change
|
279 |
-
$( document.body ).on( 'wpo-wcpdf-media-upload-setting-updated', function( event, $input ) {
|
280 |
-
settingsChanged();
|
281 |
-
} );
|
282 |
-
$( document ).on( 'click', '.wpo_remove_image_button', function( event ) {
|
283 |
-
settingsChanged();
|
284 |
-
} );
|
285 |
-
|
286 |
// Custom trigger to signify settings have changed (will show save button and refresh preview)
|
287 |
$( document ).on( 'wpo-wcpdf-settings-changed', function( event, delay ) {
|
288 |
-
|
|
|
289 |
} );
|
290 |
|
291 |
// Custom trigger to refresh preview
|
@@ -303,12 +263,40 @@ jQuery( function( $ ) {
|
|
303 |
triggerPreview();
|
304 |
} );
|
305 |
|
306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
showSaveBtn();
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
-
function showSaveBtn() {
|
312 |
$('.preview-data-wrapper .save-settings p').css('margin-right', '0');
|
313 |
}
|
314 |
|
242 |
// Preview on page load
|
243 |
$( document ).ready( triggerPreview() );
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
// Custom trigger to signify settings have changed (will show save button and refresh preview)
|
246 |
$( document ).on( 'wpo-wcpdf-settings-changed', function( event, delay ) {
|
247 |
+
showSaveBtn();
|
248 |
+
triggerPreview( delay );
|
249 |
} );
|
250 |
|
251 |
// Custom trigger to refresh preview
|
263 |
triggerPreview();
|
264 |
} );
|
265 |
|
266 |
+
// Check for settings change
|
267 |
+
$( document ).on( 'keyup paste', '#wpo-wcpdf-settings input, #wpo-wcpdf-settings textarea', settingsChanged );
|
268 |
+
$( document ).on( 'change', '#wpo-wcpdf-settings input[type="checkbox"], #wpo-wcpdf-settings input[type="radio"], #wpo-wcpdf-settings select', function( event ) {
|
269 |
+
if ( ! event.isTrigger ) { // exclude programmatic triggers that aren't actually changing anything
|
270 |
+
settingsChanged( event );
|
271 |
+
}
|
272 |
+
});
|
273 |
+
$( document ).on( 'select2:select select2:unselect', '#wpo-wcpdf-settings select.wc-enhanced-select', settingsChanged );
|
274 |
+
$( document.body ).on( 'wpo-wcpdf-media-upload-setting-updated', settingsChanged );
|
275 |
+
$( document ).on( 'click', '.wpo_remove_image_button', settingsChanged );
|
276 |
+
|
277 |
+
function settingsChanged( event, previewDelay ) {
|
278 |
+
|
279 |
+
// Show secondary save button
|
280 |
showSaveBtn();
|
281 |
+
|
282 |
+
// Check if preview needs to reload and with what delay
|
283 |
+
let $element = $( event.target );
|
284 |
+
|
285 |
+
if ( ! settingIsExcludedForPreview( $element.attr('name') ) ) {
|
286 |
+
|
287 |
+
if ( jQuery.inArray( event.type, ['keyup', 'paste'] ) !== -1 ) {
|
288 |
+
if ( $element.is( 'input[type="checkbox"], select' ) ) {
|
289 |
+
return;
|
290 |
+
} else {
|
291 |
+
previewDelay = event.type == 'keyup' ? 1000 : 0;
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
triggerPreview( previewDelay );
|
296 |
+
}
|
297 |
}
|
298 |
|
299 |
+
function showSaveBtn( event ) {
|
300 |
$('.preview-data-wrapper .save-settings p').css('margin-right', '0');
|
301 |
}
|
302 |
|
assets/js/admin-script.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(a){function b(){n=w.val(),o=x.val(),p=y.val(),q=z.serialize()}function c(){x.val(x.data("default")).trigger("change")}function d(){w.val("").trigger("change")}function e(){!1==u.attr("data-preview-states-lock")&&(1200>=a(this).width()&&(1200<t||a(this).width()==t)?"full"==u.attr("data-preview-state")?(u.find(".preview-document").show(),u.find(".sidebar").hide(),u.find(".slide-left").hide(),u.find(".slide-right").show(),u.attr("data-preview-states",2),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","")):(u.find(".preview-document").hide(),u.find(".sidebar").show(),u.find(".slide-left").show(),u.find(".slide-right").hide(),u.attr("data-preview-states",2),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state","")):1200<a(this).width()&&(1200>=t||a(this).width()==t)&&("full"==u.attr("data-preview-state")?(u.find(".preview-document").show(),u.find(".sidebar").hide(),u.find(".slide-left").hide(),u.find(".slide-right").show(),u.attr("data-preview-states",3),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","sidebar"),u.addClass("static")):"closed"==u.attr("data-preview-state")&&a(this).width()!==t?(u.find(".preview-document").hide(),u.find(".sidebar").show(),u.find(".slide-left").show(),u.find(".slide-right").hide(),u.attr("data-preview-states",3),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state",""),u.removeClass("static")):(u.find(".preview-document, .sidebar").show(),u.find(".slide-left, .slide-right").show(),u.attr("data-preview-states",3),u.attr("data-preview-state","sidebar"),u.attr("data-from-preview-state",""),u.removeClass("static")))),t=a(this).width()}function f(a){window.scrollTo(0,0);setTimeout(function(){a.addClass("static")},300)}function g(a){h(),i(a)}function h(){a(".preview-data-wrapper .save-settings p").css("margin-right","0")}function i(a){a="number"==typeof a?a:0,b(),clearTimeout(r),r=setTimeout(function(){k()},a)}function j(b){let c=!1;if(!b)return c;let d=b.includes("[")?b.match(/\[(.*?)\]/)[1]:b;return-1!==a.inArray(d,wpo_wcpdf_admin.preview_excluded_settings)&&(c=!0),c}function k(){let b=wpo_wcpdf_admin.pdfjs_worker,c="preview-canvas",d={action:"wpo_wcpdf_preview",security:p,order_id:n,document_type:o,data:q};v.children(".notice").remove(),v.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),A=a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:d,beforeSend:function(){null!=A&&A.abort()},success:function(d){d.data.error?(a("#"+c).remove(),v.append("<div class=\"notice notice-error inline\"><p>"+d.data.error+"</p></div>")):d.data.pdf_data&&(a("#"+c).remove(),v.append("<canvas id=\""+c+"\" style=\"width:100%;\"></canvas>"),l(b,c,d.data.pdf_data)),v.unblock()},error:function(b,d){if("abort"!=d){let d=b.status+": "+b.statusText;a("#"+c).remove(),v.append("<div class=\"notice notice-error inline\"><p>"+d+"</p></div>"),v.unblock()}}})}function l(a,b,c){c=window.atob(c);let d=window["pdfjs-dist/build/pdf"];d.GlobalWorkerOptions.workerSrc=a;let e=d.getDocument({data:c});e.promise.then(function(a){a.getPage(1).then(function(a){let c=a.getViewport({scale:2}),d=document.getElementById(b),e=d.getContext("2d");d.height=c.height,d.width=c.width;let f=a.render({canvasContext:e,viewport:c});f.promise.then(function(){})})},function(a){console.error(a)})}function m(b){let c=b.closest(".preview-data").find("#preview-order-search-results"),d=b.val(),e=b.data("nonce"),f={security:e,action:"wpo_wcpdf_preview_order_search",search:d,document_type:o};c.parent().find("img.preview-order-search-clear").hide(),c.children(".error").remove(),c.children("a").remove(),c.hide(),a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:f,success:function(d){d.data&&(d.data.error?(c.append("<span class=\"error\">"+d.data.error+"</span>"),c.show()):a.each(d.data,function(a,b){let d="<a data-order_id=\""+a+"\"><span class=\"order-number\">#"+b.order_number+"</span> - "+b.billing_first_name+" "+b.billing_last_name;0<b.billing_company.length&&(d=d+", "+b.billing_company);let e="<br><span class=\"date\">"+b.date_created+"</span><span class=\"total\">"+b.total+"</span></a>";c.append(d+e),c.show()})),b.removeClass("ajax-waiting"),b.closest("div").find("img.preview-order-search-clear").show()}})}a(".wcpdf-extensions .more").hide(),a(".wcpdf-extensions > li").on("click",function(){a(this).toggleClass("expanded"),a(this).find(".more").slideToggle()}),a(".edit-next-number").on("click",function(){a(this).hide(),a(this).siblings("input").prop("disabled",!1),a(this).siblings(".save-next-number.button").show()}),a(".save-next-number").on("click",function(){$input=a(this).siblings("input"),$input.addClass("ajax-waiting");let b={security:$input.data("nonce"),action:"wpo_wcpdf_set_next_number",store:$input.data("store"),number:$input.val()};xhr=a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:b,success:function(){$input.removeClass("ajax-waiting"),$input.siblings(".edit-next-number").show(),$input.prop("disabled","disabled"),$input.siblings(".save-next-number.button").hide()}})}),a("[name='wpo_wcpdf_documents_settings_invoice[display_number]']").on("change",function(){"order_number"==a(this).val()?a(this).closest("td").find(".description").slideDown():a(this).closest("td").find(".description").hide()}).trigger("change"),a(".wcpdf_document_settings_sections > h2").on("click",function(){a(this).parent().find("ul").toggleClass("active")});let n,o,p,q,r,s,t,u=a("#wpo-wcpdf-preview-wrapper"),v=a("#wpo-wcpdf-preview-wrapper .preview"),w=a("#wpo-wcpdf-preview-wrapper input[name=\"order_id\"]"),x=a("#wpo-wcpdf-preview-wrapper input[name=\"document_type\"]"),y=a("#wpo-wcpdf-preview-wrapper input[name=\"nonce\"]"),z=a("#wpo-wcpdf-settings"),A=null;a(document).ready(function(){c(),d(),b(),t=a(window).width(),e()}),a(window).on("resize",e),a(".slide-left").on("click",function(){let a=u.attr("data-preview-states"),b=u.attr("data-preview-state");u.find(".preview-data-wrapper ul").removeClass("active"),3==a?"closed"==b?(u.find(".preview-document").show(),u.find(".slide-right").show(),u.attr("data-preview-state","sidebar"),u.attr("data-from-preview-state","closed")):(u.find(".slide-left").hide(),u.find(".sidebar").delay(300).hide(0),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","sidebar"),f(u)):(u.find(".preview-document").show(),u.find(".slide-left").hide(),u.find(".slide-right").show(),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","closed"),f(u))}),a(".slide-right").on("click",function(){let a=u.attr("data-preview-states"),b=u.attr("data-preview-state");u.find(".preview-data-wrapper ul").removeClass("active"),3==a?"full"==b?(u.find(".slide-left").delay(400).show(0),u.find(".sidebar").show(),u.attr("data-preview-state","sidebar"),u.attr("data-from-preview-state","full")):(u.find(".preview-document").hide(300),u.find(".slide-right").hide(),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state","sidebar")):(u.find(".preview-document").hide(300),u.find(".slide-left").show(),u.find(".slide-right").hide(),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state","full")),u.removeClass("static")}),a(".preview-document .preview-data p").on("click",function(){let b=a(this).closest(".preview-data");b.siblings(".preview-data").find("ul").removeClass("active"),b.find("ul").toggleClass("active")}),a(".preview-document .preview-data ul > li").on("click",function(){let b=a(this).closest(".preview-data");b.find("ul").toggleClass("active"),a(this).hasClass("order-search")?(b.find("p.last-order").hide(),b.find("input[name=\"preview-order-search\"]").addClass("active"),b.find("p.order-search").show().find(".order-search-label").text(a(this).text())):(b.find("p.last-order").show(),b.find("p.order-search").hide(),b.find("input[name=\"preview-order-search\"]").removeClass("active").val(""),b.find("#preview-order-search-results").hide(),b.find("img.preview-order-search-clear").hide(),d(),i())}),a(document).ready(i()),a(document).on("keyup paste","#wpo-wcpdf-settings input:not([type=checkbox]), #wpo-wcpdf-settings textarea, #wpo-wcpdf-settings select:not(.dropdown-add-field)",function(b){if(!j(a(this).attr("name"))){let a="keyup"==b.type?1e3:0;g(a)}}),a(document).on("click","#wpo-wcpdf-settings select:not(.dropdown-add-field) option",function(){j(a(this).parent().attr("name"))||g()}),a(document).on("change","#wpo-wcpdf-settings input[type=\"checkbox\"]",function(b){j(a(this).attr("name"))||b.isTrigger||g(1e3)}),a(document).on("change","#wpo-wcpdf-settings input[type=\"radio\"], #wpo-wcpdf-settings select",function(b){j(a(this).attr("name"))||b.isTrigger||g()}),a(document.body).on("wpo-wcpdf-media-upload-setting-updated",function(){g()}),a(document).on("click",".wpo_remove_image_button",function(){g()}),a(document).on("wpo-wcpdf-settings-changed",function(a,b){g(b)}),a(document).on("wpo-wcpdf-refresh-preview wpo_wcpdf_refresh_preview",function(a,b){i(b)}),a(document).on("click","#preview-order-search-results a",function(b){b.preventDefault(),a(".preview-document .order-search-label").text("#"+a(this).data("order_id")),w.val(a(this).data("order_id")).change(),a(this).closest("div").hide(),a(this).closest("div").children("a").remove(),i()}),a(document).on("click",".preview-data-wrapper .save-settings p input",function(){a("#wpo-wcpdf-settings input#submit").click()}),a(document).on("click","img.preview-order-search-clear",function(b){b.preventDefault(),a(this).closest("div").find("input#preview-order-search").val(""),a(this).closest(".preview-data").find("#preview-order-search-results").children("a").remove(),a(this).closest(".preview-data").find("#preview-order-search-results").children(".error").remove(),a(this).closest(".preview-data").find("#preview-order-search-results").hide(),a(this).hide()}),a("#wpo-wcpdf-preview-wrapper ul.preview-data-option-list li").on("click",function(){let b=a(this).closest("ul").data("input-name"),c=a("#wpo-wcpdf-preview-wrapper :input[name="+b+"]");c.val(a(this).data("value")).trigger("change")}),x.on("change",function(){let b=a(this).val();if(b.length){let c=a(this).attr("name"),d=a("#wpo-wcpdf-preview-wrapper ul.preview-data-option-list[data-input-name="+c+"]"),e=d.find("li[data-value="+b+"]");d.parent().find(".current-label").text(e.text()),i()}}).trigger("change"),w.on("change",function(){i()}).trigger("change"),a("#preview-order-search").on("keyup paste",function(c){let d=a(this);d.addClass("ajax-waiting");let e="keyup"==c.type?1e3:0;b(),clearTimeout(s),s=setTimeout(function(){m(d)},e)})});
|
1 |
+
jQuery(function(a){function b(){n=w.val(),o=x.val(),p=y.val(),q=z.serialize()}function c(){x.val(x.data("default")).trigger("change")}function d(){w.val("").trigger("change")}function e(){!1==u.attr("data-preview-states-lock")&&(1200>=a(this).width()&&(1200<t||a(this).width()==t)?"full"==u.attr("data-preview-state")?(u.find(".preview-document").show(),u.find(".sidebar").hide(),u.find(".slide-left").hide(),u.find(".slide-right").show(),u.attr("data-preview-states",2),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","")):(u.find(".preview-document").hide(),u.find(".sidebar").show(),u.find(".slide-left").show(),u.find(".slide-right").hide(),u.attr("data-preview-states",2),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state","")):1200<a(this).width()&&(1200>=t||a(this).width()==t)&&("full"==u.attr("data-preview-state")?(u.find(".preview-document").show(),u.find(".sidebar").hide(),u.find(".slide-left").hide(),u.find(".slide-right").show(),u.attr("data-preview-states",3),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","sidebar"),u.addClass("static")):"closed"==u.attr("data-preview-state")&&a(this).width()!==t?(u.find(".preview-document").hide(),u.find(".sidebar").show(),u.find(".slide-left").show(),u.find(".slide-right").hide(),u.attr("data-preview-states",3),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state",""),u.removeClass("static")):(u.find(".preview-document, .sidebar").show(),u.find(".slide-left, .slide-right").show(),u.attr("data-preview-states",3),u.attr("data-preview-state","sidebar"),u.attr("data-from-preview-state",""),u.removeClass("static")))),t=a(this).width()}function f(a){window.scrollTo(0,0);let b=a;setTimeout(function(){b.addClass("static")},300)}function g(b,c){h();let d=a(b.target);if(!j(d.attr("name"))){if(-1!==jQuery.inArray(b.type,["keyup","paste"])){if(d.is("input[type=\"checkbox\"], select"))return;c="keyup"==b.type?1e3:0}i(c)}}function h(b){a(".preview-data-wrapper .save-settings p").css("margin-right","0")}function i(a){a="number"==typeof a?a:0,b(),clearTimeout(r),r=setTimeout(function(){k()},a)}function j(b){let c=!1;if(!b)return c;let d=b.includes("[")?b.match(/\[(.*?)\]/)[1]:b;return-1!==a.inArray(d,wpo_wcpdf_admin.preview_excluded_settings)&&(c=!0),c}function k(){let b=wpo_wcpdf_admin.pdfjs_worker,c="preview-canvas",d={action:"wpo_wcpdf_preview",security:p,order_id:n,document_type:o,data:q};v.children(".notice").remove(),v.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),A=a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:d,beforeSend:function(a,b){null!=A&&A.abort()},success:function(d,e,f){d.data.error?(a("#"+c).remove(),v.append("<div class=\"notice notice-error inline\"><p>"+d.data.error+"</p></div>")):d.data.pdf_data&&(a("#"+c).remove(),v.append("<canvas id=\""+c+"\" style=\"width:100%;\"></canvas>"),l(b,c,d.data.pdf_data)),v.unblock()},error:function(b,d,e){if("abort"!=d){let d=b.status+": "+b.statusText;a("#"+c).remove(),v.append("<div class=\"notice notice-error inline\"><p>"+d+"</p></div>"),v.unblock()}}})}function l(a,b,c){c=window.atob(c);let d=window["pdfjs-dist/build/pdf"];d.GlobalWorkerOptions.workerSrc=a;let e=d.getDocument({data:c});e.promise.then(function(a){let c=1;a.getPage(1).then(function(a){let c=2,d=a.getViewport({scale:2}),e=document.getElementById(b),f=e.getContext("2d");e.height=d.height,e.width=d.width;let g={canvasContext:f,viewport:d},h=a.render(g);h.promise.then(function(){})})},function(a){console.error(a)})}function m(b){let c=b.closest(".preview-data").find("#preview-order-search-results"),d=b.val(),e=b.data("nonce"),f="wpo_wcpdf_preview_order_search",g={security:e,action:f,search:d,document_type:o};c.parent().find("img.preview-order-search-clear").hide(),c.children(".error").remove(),c.children("a").remove(),c.hide(),a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:g,success:function(d){d.data&&(d.data.error?(c.append("<span class=\"error\">"+d.data.error+"</span>"),c.show()):a.each(d.data,function(a,b){let d="<a data-order_id=\""+a+"\"><span class=\"order-number\">#"+b.order_number+"</span> - "+b.billing_first_name+" "+b.billing_last_name;0<b.billing_company.length&&(d=d+", "+b.billing_company);let e="<br><span class=\"date\">"+b.date_created+"</span><span class=\"total\">"+b.total+"</span></a>";c.append(d+e),c.show()})),b.removeClass("ajax-waiting"),b.closest("div").find("img.preview-order-search-clear").show()}})}a(".wcpdf-extensions .more").hide(),a(".wcpdf-extensions > li").on("click",function(b){a(this).toggleClass("expanded"),a(this).find(".more").slideToggle()}),a(".edit-next-number").on("click",function(b){a(this).hide(),a(this).siblings("input").prop("disabled",!1),a(this).siblings(".save-next-number.button").show()}),a(".save-next-number").on("click",function(b){$input=a(this).siblings("input"),$input.addClass("ajax-waiting");let c={security:$input.data("nonce"),action:"wpo_wcpdf_set_next_number",store:$input.data("store"),number:$input.val()};xhr=a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:c,success:function(a){$input.removeClass("ajax-waiting"),$input.siblings(".edit-next-number").show(),$input.prop("disabled","disabled"),$input.siblings(".save-next-number.button").hide()}})}),a("[name='wpo_wcpdf_documents_settings_invoice[display_number]']").on("change",function(b){"order_number"==a(this).val()?a(this).closest("td").find(".description").slideDown():a(this).closest("td").find(".description").hide()}).trigger("change"),a(".wcpdf_document_settings_sections > h2").on("click",function(){a(this).parent().find("ul").toggleClass("active")});let n,o,p,q,r,s,t,u=a("#wpo-wcpdf-preview-wrapper"),v=a("#wpo-wcpdf-preview-wrapper .preview"),w=a("#wpo-wcpdf-preview-wrapper input[name=\"order_id\"]"),x=a("#wpo-wcpdf-preview-wrapper input[name=\"document_type\"]"),y=a("#wpo-wcpdf-preview-wrapper input[name=\"nonce\"]"),z=a("#wpo-wcpdf-settings"),A=null;a(document).ready(function(){c(),d(),b(),t=a(window).width(),e()}),a(window).on("resize",e),a(".slide-left").on("click",function(){let a=u.attr("data-preview-states"),b=u.attr("data-preview-state");u.find(".preview-data-wrapper ul").removeClass("active"),3==a?"closed"==b?(u.find(".preview-document").show(),u.find(".slide-right").show(),u.attr("data-preview-state","sidebar"),u.attr("data-from-preview-state","closed")):(u.find(".slide-left").hide(),u.find(".sidebar").delay(300).hide(0),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","sidebar"),f(u)):(u.find(".preview-document").show(),u.find(".slide-left").hide(),u.find(".slide-right").show(),u.attr("data-preview-state","full"),u.attr("data-from-preview-state","closed"),f(u))}),a(".slide-right").on("click",function(){let a=u.attr("data-preview-states"),b=u.attr("data-preview-state");u.find(".preview-data-wrapper ul").removeClass("active"),3==a?"full"==b?(u.find(".slide-left").delay(400).show(0),u.find(".sidebar").show(),u.attr("data-preview-state","sidebar"),u.attr("data-from-preview-state","full")):(u.find(".preview-document").hide(300),u.find(".slide-right").hide(),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state","sidebar")):(u.find(".preview-document").hide(300),u.find(".slide-left").show(),u.find(".slide-right").hide(),u.attr("data-preview-state","closed"),u.attr("data-from-preview-state","full")),u.removeClass("static")}),a(".preview-document .preview-data p").on("click",function(){let b=a(this).closest(".preview-data");b.siblings(".preview-data").find("ul").removeClass("active"),b.find("ul").toggleClass("active")}),a(".preview-document .preview-data ul > li").on("click",function(){let b=a(this).closest(".preview-data");b.find("ul").toggleClass("active"),a(this).hasClass("order-search")?(b.find("p.last-order").hide(),b.find("input[name=\"preview-order-search\"]").addClass("active"),b.find("p.order-search").show().find(".order-search-label").text(a(this).text())):(b.find("p.last-order").show(),b.find("p.order-search").hide(),b.find("input[name=\"preview-order-search\"]").removeClass("active").val(""),b.find("#preview-order-search-results").hide(),b.find("img.preview-order-search-clear").hide(),d(),i())}),a(document).ready(i()),a(document).on("wpo-wcpdf-settings-changed",function(a,b){h(),i(b)}),a(document).on("wpo-wcpdf-refresh-preview wpo_wcpdf_refresh_preview",function(a,b){i(b)}),a(document).on("click","#preview-order-search-results a",function(b){b.preventDefault(),a(".preview-document .order-search-label").text("#"+a(this).data("order_id")),w.val(a(this).data("order_id")).change(),a(this).closest("div").hide(),a(this).closest("div").children("a").remove(),i()}),a(document).on("keyup paste","#wpo-wcpdf-settings input, #wpo-wcpdf-settings textarea",g),a(document).on("change","#wpo-wcpdf-settings input[type=\"checkbox\"], #wpo-wcpdf-settings input[type=\"radio\"], #wpo-wcpdf-settings select",function(a){a.isTrigger||g(a)}),a(document).on("select2:select select2:unselect","#wpo-wcpdf-settings select.wc-enhanced-select",g),a(document.body).on("wpo-wcpdf-media-upload-setting-updated",g),a(document).on("click",".wpo_remove_image_button",g),a(document).on("click",".preview-data-wrapper .save-settings p input",function(b){a("#wpo-wcpdf-settings input#submit").click()}),a(document).on("click","img.preview-order-search-clear",function(b){b.preventDefault(),a(this).closest("div").find("input#preview-order-search").val(""),a(this).closest(".preview-data").find("#preview-order-search-results").children("a").remove(),a(this).closest(".preview-data").find("#preview-order-search-results").children(".error").remove(),a(this).closest(".preview-data").find("#preview-order-search-results").hide(),a(this).hide()}),a("#wpo-wcpdf-preview-wrapper ul.preview-data-option-list li").on("click",function(){let b=a(this).closest("ul").data("input-name"),c=a("#wpo-wcpdf-preview-wrapper :input[name="+b+"]");c.val(a(this).data("value")).trigger("change")}),x.on("change",function(){let b=a(this).val();if(b.length){let c=a(this).attr("name"),d=a("#wpo-wcpdf-preview-wrapper ul.preview-data-option-list[data-input-name="+c+"]"),e=d.find("li[data-value="+b+"]");d.parent().find(".current-label").text(e.text()),i()}}).trigger("change"),w.on("change",function(){i()}).trigger("change"),a("#preview-order-search").on("keyup paste",function(c){let d=a(this);d.addClass("ajax-waiting");let e="keyup"==c.type?1e3:0;b(),clearTimeout(s),s=setTimeout(function(){m(d)},e)})});
|
assets/js/confetti.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(a){var b=Math.PI,c=Math.sin,d=Math.cos,e=Math.round,f=Math.sqrt;function g(a,b){this.x=a,this.y=b,this.Length=function(){return f(this.SqrLength())},this.SqrLength=function(){return this.x*this.x+this.y*this.y},this.Equals=function(a,b){return a.x==b.x&&a.y==b.y},this.Add=function(a){this.x+=a.x,this.y+=a.y},this.Sub=function(a){this.x-=a.x,this.y-=a.y},this.Div=function(a){this.x/=a,this.y/=a},this.Mul=function(a){this.x*=a,this.y*=a},this.Normalize=function(){var a=this.SqrLength();if(0!=a){var b=1/f(a);this.x*=b,this.y*=b}},this.Normalized=function(){var a=this.SqrLength();if(0!=a){var b=1/f(a);return new g(this.x*b,this.y*b)}return new g(0,0)}}function h(a,b,c,d){this.position=new g(a,b),this.mass=c,this.drag=d,this.force=new g(0,0),this.velocity=new g(0,0),this.AddForce=function(a){this.force.Add(a)},this.Integrate=function(a){var b=this.CurrentForce(this.position);b.Div(this.mass);var c=new g(this.velocity.x,this.velocity.y);c.Mul(a),this.position.Add(c),b.Mul(a),this.velocity.Add(b),this.force=new g(0,0)},this.CurrentForce=function(){var a=new g(this.force.x,this.force.y),b=this.velocity.Length(),c=new g(this.velocity.x,this.velocity.y);return c.Mul(this.drag*this.mass*b),a.Sub(c),a}}function j(a,b){this.pos=new g(a,b),this.rotationSpeed=600*Math.random()+800,this.angle=360*(m*Math.random()),this.rotation=360*(m*Math.random()),this.cosA=1,this.size=5,this.oscillationSpeed=1.5*Math.random()+.5,this.xSpeed=40,this.ySpeed=60*Math.random()+50,this.corners=[],this.time=Math.random();var f=e(Math.random()*(n.length-1));this.frontColor=n[f][0],this.backColor=n[f][1];for(var h=0;4>h;h++){var k=d(this.angle+m*(90*h+45)),l=c(this.angle+m*(90*h+45));this.corners[h]=new g(k,l)}this.Update=function(a){this.time+=a,this.rotation+=this.rotationSpeed*a,this.cosA=d(m*this.rotation),this.pos.x+=d(this.time*this.oscillationSpeed)*this.xSpeed*a,this.pos.y+=this.ySpeed*a,this.pos.y>j.bounds.y&&(this.pos.x=Math.random()*j.bounds.x,this.pos.y=0)},this.Draw=function(a){a.fillStyle=0<this.cosA?this.frontColor:this.backColor,a.beginPath(),a.moveTo(this.pos.x+this.corners[0].x*this.size,this.pos.y+this.corners[0].y*this.size*this.cosA);for(var b=1;4>b;b++)a.lineTo(this.pos.x+this.corners[b].x*this.size,this.pos.y+this.corners[b].y*this.size*this.cosA);a.closePath(),a.fill()}}function k(a,b,j,l,o,p,q,r){this.particleDist=l,this.particleCount=j,this.particleMass=q,this.particleDrag=r,this.particles=[];var s=e(Math.random()*(n.length-1));this.frontColor=n[s][0],this.backColor=n[s][1],this.xOff=d(m*p)*o,this.yOff=c(m*p)*o,this.position=new g(a,b),this.prevPosition=new g(a,b),this.velocityInherit=2*Math.random()+4,this.time=100*Math.random(),this.oscillationSpeed=2*Math.random()+2,this.oscillationDistance=40*Math.random()+40,this.ySpeed=40*Math.random()+80;for(var t=0;t<this.particleCount;t++)this.particles[t]=new h(a,b-t*this.particleDist,this.particleMass,this.particleDrag);this.Update=function(a){var b=0;this.time+=a*this.oscillationSpeed,this.position.y+=this.ySpeed*a,this.position.x+=d(this.time)*this.oscillationDistance*a,this.particles[0].position=this.position;var c=this.prevPosition.x-this.position.x,e=this.prevPosition.y-this.position.y,h=f(c*c+e*e);for(this.prevPosition=new g(this.position.x,this.position.y),b=1;b<this.particleCount;b++){var j=g.Sub(this.particles[b-1].position,this.particles[b].position);j.Normalize(),j.Mul(h/a*this.velocityInherit),this.particles[b].AddForce(j)}for(b=1;b<this.particleCount;b++)this.particles[b].Integrate(a);for(b=1;b<this.particleCount;b++){var l=new g(this.particles[b].position.x,this.particles[b].position.y);l.Sub(this.particles[b-1].position),l.Normalize(),l.Mul(this.particleDist),l.Add(this.particles[b-1].position),this.particles[b].position=l}this.position.y>k.bounds.y+this.particleDist*this.particleCount&&this.Reset()},this.Reset=function(){this.position.y=-Math.random()*k.bounds.y,this.position.x=Math.random()*k.bounds.x,this.prevPosition=new g(this.position.x,this.position.y),this.velocityInherit=2*Math.random()+4,this.time=100*Math.random(),this.oscillationSpeed=2*Math.random()+1.5,this.oscillationDistance=40*Math.random()+40,this.ySpeed=40*Math.random()+80;var a=e(Math.random()*(n.length-1));this.frontColor=n[a][0],this.backColor=n[a][1],this.particles=[];for(var b=0;b<this.particleCount;b++)this.particles[b]=new h(this.position.x,this.position.y-b*this.particleDist,this.particleMass,this.particleDrag)},this.Draw=function(a){for(var b=0;b<this.particleCount-1;b++){var c=new g(this.particles[b].position.x+this.xOff,this.particles[b].position.y+this.yOff),d=new g(this.particles[b+1].position.x+this.xOff,this.particles[b+1].position.y+this.yOff);0>this.Side(this.particles[b].position.x,this.particles[b].position.y,this.particles[b+1].position.x,this.particles[b+1].position.y,d.x,d.y)?(a.fillStyle=this.frontColor,a.strokeStyle=this.frontColor):(a.fillStyle=this.backColor,a.strokeStyle=this.backColor),0==b?(a.beginPath(),a.moveTo(this.particles[b].position.x,this.particles[b].position.y),a.lineTo(this.particles[b+1].position.x,this.particles[b+1].position.y),a.lineTo(.5*(this.particles[b+1].position.x+d.x),.5*(this.particles[b+1].position.y+d.y)),a.closePath(),a.stroke(),a.fill(),a.beginPath(),a.moveTo(d.x,d.y),a.lineTo(c.x,c.y),a.lineTo(.5*(this.particles[b+1].position.x+d.x),.5*(this.particles[b+1].position.y+d.y)),a.closePath(),a.stroke(),a.fill()):b==this.particleCount-2?(a.beginPath(),a.moveTo(this.particles[b].position.x,this.particles[b].position.y),a.lineTo(this.particles[b+1].position.x,this.particles[b+1].position.y),a.lineTo(.5*(this.particles[b].position.x+c.x),.5*(this.particles[b].position.y+c.y)),a.closePath(),a.stroke(),a.fill(),a.beginPath(),a.moveTo(d.x,d.y),a.lineTo(c.x,c.y),a.lineTo(.5*(this.particles[b].position.x+c.x),.5*(this.particles[b].position.y+c.y)),a.closePath(),a.stroke(),a.fill()):(a.beginPath(),a.moveTo(this.particles[b].position.x,this.particles[b].position.y),a.lineTo(this.particles[b+1].position.x,this.particles[b+1].position.y),a.lineTo(d.x,d.y),a.lineTo(c.x,c.y),a.closePath(),a.stroke(),a.fill())}},this.Side=function(a,b,c,d,e,f){return(a-c)*(f-d)-(b-d)*(e-c)}}var l=1/30,m=b/180,n=[["#771787","#239bb9"]];g.Lerp=function(a,b,c){return new g((b.x-a.x)*c+a.x,(b.y-a.y)*c+a.y)},g.Distance=function(a,b){return f(g.SqrDistance(a,b))},g.SqrDistance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d+z*z},g.Scale=function(a,b){return new g(a.x*b.x,a.y*b.y)},g.Min=function(a,b){var c=Math.min;return new g(c(a.x,b.x),c(a.y,b.y))},g.Max=function(a,b){var c=Math.max;return new g(c(a.x,b.x),c(a.y,b.y))},g.ClampMagnitude=function(a,b){var c=a.Normalized;return new g(c.x*b,c.y*b)},g.Sub=function(a,b){return new g(a.x-b.x,a.y-b.y,a.z-b.z)},j.bounds=new g(0,0),k.bounds=new g(0,0),o={},o.Context=function(a){var b=0,c=document.getElementById(a),d=document.createElement("canvas");d.width=c.offsetWidth,d.height=c.offsetHeight,c.appendChild(d);var e=d.getContext("2d"),f=7,h=[];for(k.bounds=new g(d.width,d.height),b=0;b<f;b++)h[b]=new k(Math.random()*d.width,2*(-Math.random()*d.height),30,8,8,45,1,.05);var m=[];for(j.bounds=new g(d.width,d.height),b=0;b<25;b++)m[b]=new j(Math.random()*d.width,Math.random()*d.height);this.resize=function(){d.width=c.offsetWidth,d.height=c.offsetHeight,j.bounds=new g(d.width,d.height),k.bounds=new g(d.width,d.height)},this.start=function(){this.stop();this
|
1 |
+
jQuery(document).ready(function(a){var b=Math.PI,c=Math.sin,d=Math.cos,e=Math.round,f=Math.sqrt;function g(a,b){this.x=a,this.y=b,this.Length=function(){return f(this.SqrLength())},this.SqrLength=function(){return this.x*this.x+this.y*this.y},this.Equals=function(a,b){return a.x==b.x&&a.y==b.y},this.Add=function(a){this.x+=a.x,this.y+=a.y},this.Sub=function(a){this.x-=a.x,this.y-=a.y},this.Div=function(a){this.x/=a,this.y/=a},this.Mul=function(a){this.x*=a,this.y*=a},this.Normalize=function(){var a=this.SqrLength();if(0!=a){var b=1/f(a);this.x*=b,this.y*=b}},this.Normalized=function(){var a=this.SqrLength();if(0!=a){var b=1/f(a);return new g(this.x*b,this.y*b)}return new g(0,0)}}function h(a,b,c,d){this.position=new g(a,b),this.mass=c,this.drag=d,this.force=new g(0,0),this.velocity=new g(0,0),this.AddForce=function(a){this.force.Add(a)},this.Integrate=function(a){var b=this.CurrentForce(this.position);b.Div(this.mass);var c=new g(this.velocity.x,this.velocity.y);c.Mul(a),this.position.Add(c),b.Mul(a),this.velocity.Add(b),this.force=new g(0,0)},this.CurrentForce=function(){var a=new g(this.force.x,this.force.y),b=this.velocity.Length(),c=new g(this.velocity.x,this.velocity.y);return c.Mul(this.drag*this.mass*b),a.Sub(c),a}}function j(a,b){this.pos=new g(a,b),this.rotationSpeed=600*Math.random()+800,this.angle=360*(m*Math.random()),this.rotation=360*(m*Math.random()),this.cosA=1,this.size=5,this.oscillationSpeed=1.5*Math.random()+.5,this.xSpeed=40,this.ySpeed=60*Math.random()+50,this.corners=[],this.time=Math.random();var f=e(Math.random()*(n.length-1));this.frontColor=n[f][0],this.backColor=n[f][1];for(var h=0;4>h;h++){var k=d(this.angle+m*(90*h+45)),l=c(this.angle+m*(90*h+45));this.corners[h]=new g(k,l)}this.Update=function(a){this.time+=a,this.rotation+=this.rotationSpeed*a,this.cosA=d(m*this.rotation),this.pos.x+=d(this.time*this.oscillationSpeed)*this.xSpeed*a,this.pos.y+=this.ySpeed*a,this.pos.y>j.bounds.y&&(this.pos.x=Math.random()*j.bounds.x,this.pos.y=0)},this.Draw=function(a){a.fillStyle=0<this.cosA?this.frontColor:this.backColor,a.beginPath(),a.moveTo(this.pos.x+this.corners[0].x*this.size,this.pos.y+this.corners[0].y*this.size*this.cosA);for(var b=1;4>b;b++)a.lineTo(this.pos.x+this.corners[b].x*this.size,this.pos.y+this.corners[b].y*this.size*this.cosA);a.closePath(),a.fill()}}function k(a,b,j,l,o,p,q,r){this.particleDist=l,this.particleCount=j,this.particleMass=q,this.particleDrag=r,this.particles=[];var s=e(Math.random()*(n.length-1));this.frontColor=n[s][0],this.backColor=n[s][1],this.xOff=d(m*p)*o,this.yOff=c(m*p)*o,this.position=new g(a,b),this.prevPosition=new g(a,b),this.velocityInherit=2*Math.random()+4,this.time=100*Math.random(),this.oscillationSpeed=2*Math.random()+2,this.oscillationDistance=40*Math.random()+40,this.ySpeed=40*Math.random()+80;for(var t=0;t<this.particleCount;t++)this.particles[t]=new h(a,b-t*this.particleDist,this.particleMass,this.particleDrag);this.Update=function(a){var b=0;this.time+=a*this.oscillationSpeed,this.position.y+=this.ySpeed*a,this.position.x+=d(this.time)*this.oscillationDistance*a,this.particles[0].position=this.position;var c=this.prevPosition.x-this.position.x,e=this.prevPosition.y-this.position.y,h=f(c*c+e*e);for(this.prevPosition=new g(this.position.x,this.position.y),b=1;b<this.particleCount;b++){var j=g.Sub(this.particles[b-1].position,this.particles[b].position);j.Normalize(),j.Mul(h/a*this.velocityInherit),this.particles[b].AddForce(j)}for(b=1;b<this.particleCount;b++)this.particles[b].Integrate(a);for(b=1;b<this.particleCount;b++){var l=new g(this.particles[b].position.x,this.particles[b].position.y);l.Sub(this.particles[b-1].position),l.Normalize(),l.Mul(this.particleDist),l.Add(this.particles[b-1].position),this.particles[b].position=l}this.position.y>k.bounds.y+this.particleDist*this.particleCount&&this.Reset()},this.Reset=function(){this.position.y=-Math.random()*k.bounds.y,this.position.x=Math.random()*k.bounds.x,this.prevPosition=new g(this.position.x,this.position.y),this.velocityInherit=2*Math.random()+4,this.time=100*Math.random(),this.oscillationSpeed=2*Math.random()+1.5,this.oscillationDistance=40*Math.random()+40,this.ySpeed=40*Math.random()+80;var a=e(Math.random()*(n.length-1));this.frontColor=n[a][0],this.backColor=n[a][1],this.particles=[];for(var b=0;b<this.particleCount;b++)this.particles[b]=new h(this.position.x,this.position.y-b*this.particleDist,this.particleMass,this.particleDrag)},this.Draw=function(a){for(var b=0;b<this.particleCount-1;b++){var c=new g(this.particles[b].position.x+this.xOff,this.particles[b].position.y+this.yOff),d=new g(this.particles[b+1].position.x+this.xOff,this.particles[b+1].position.y+this.yOff);0>this.Side(this.particles[b].position.x,this.particles[b].position.y,this.particles[b+1].position.x,this.particles[b+1].position.y,d.x,d.y)?(a.fillStyle=this.frontColor,a.strokeStyle=this.frontColor):(a.fillStyle=this.backColor,a.strokeStyle=this.backColor),0==b?(a.beginPath(),a.moveTo(this.particles[b].position.x,this.particles[b].position.y),a.lineTo(this.particles[b+1].position.x,this.particles[b+1].position.y),a.lineTo(.5*(this.particles[b+1].position.x+d.x),.5*(this.particles[b+1].position.y+d.y)),a.closePath(),a.stroke(),a.fill(),a.beginPath(),a.moveTo(d.x,d.y),a.lineTo(c.x,c.y),a.lineTo(.5*(this.particles[b+1].position.x+d.x),.5*(this.particles[b+1].position.y+d.y)),a.closePath(),a.stroke(),a.fill()):b==this.particleCount-2?(a.beginPath(),a.moveTo(this.particles[b].position.x,this.particles[b].position.y),a.lineTo(this.particles[b+1].position.x,this.particles[b+1].position.y),a.lineTo(.5*(this.particles[b].position.x+c.x),.5*(this.particles[b].position.y+c.y)),a.closePath(),a.stroke(),a.fill(),a.beginPath(),a.moveTo(d.x,d.y),a.lineTo(c.x,c.y),a.lineTo(.5*(this.particles[b].position.x+c.x),.5*(this.particles[b].position.y+c.y)),a.closePath(),a.stroke(),a.fill()):(a.beginPath(),a.moveTo(this.particles[b].position.x,this.particles[b].position.y),a.lineTo(this.particles[b+1].position.x,this.particles[b+1].position.y),a.lineTo(d.x,d.y),a.lineTo(c.x,c.y),a.closePath(),a.stroke(),a.fill())}},this.Side=function(a,b,c,d,e,f){return(a-c)*(f-d)-(b-d)*(e-c)}}var l=1/30,m=b/180,n=[["#771787","#239bb9"]];g.Lerp=function(a,b,c){return new g((b.x-a.x)*c+a.x,(b.y-a.y)*c+a.y)},g.Distance=function(a,b){return f(g.SqrDistance(a,b))},g.SqrDistance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d+z*z},g.Scale=function(a,b){return new g(a.x*b.x,a.y*b.y)},g.Min=function(a,b){var c=Math.min;return new g(c(a.x,b.x),c(a.y,b.y))},g.Max=function(a,b){var c=Math.max;return new g(c(a.x,b.x),c(a.y,b.y))},g.ClampMagnitude=function(a,b){var c=a.Normalized;return new g(c.x*b,c.y*b)},g.Sub=function(a,b){return new g(a.x-b.x,a.y-b.y,a.z-b.z)},j.bounds=new g(0,0),k.bounds=new g(0,0),o={},o.Context=function(a){var b=0,c=document.getElementById(a),d=document.createElement("canvas");d.width=c.offsetWidth,d.height=c.offsetHeight,c.appendChild(d);var e=d.getContext("2d"),f=7,h=[];for(k.bounds=new g(d.width,d.height),b=0;b<f;b++)h[b]=new k(Math.random()*d.width,2*(-Math.random()*d.height),30,8,8,45,1,.05);var m=[];for(j.bounds=new g(d.width,d.height),b=0;b<25;b++)m[b]=new j(Math.random()*d.width,Math.random()*d.height);this.resize=function(){d.width=c.offsetWidth,d.height=c.offsetHeight,j.bounds=new g(d.width,d.height),k.bounds=new g(d.width,d.height)},this.start=function(){this.stop();this.interval=setInterval(function(){o.update()},1e3/30)},this.stop=function(){clearInterval(this.interval)},this.update=function(){var a=0;for(e.clearRect(0,0,d.width,d.height),a=0;a<25;a++)m[a].Update(l),m[a].Draw(e);for(a=0;a<f;a++)h[a].Update(l),h[a].Draw(e)}};var o=new o.Context("confetti");o.start(),a(window).resize(function(){o.resize()})});
|
includes/class-wcpdf-admin.php
CHANGED
@@ -192,7 +192,7 @@ class Admin {
|
|
192 |
$document_exists = is_callable( array( $document, 'exists' ) ) ? $document->exists() : false;
|
193 |
|
194 |
$listing_actions[$document->get_type()] = array(
|
195 |
-
'url' => $pdf_url,
|
196 |
'img' => $icon,
|
197 |
'alt' => "PDF " . $document_title,
|
198 |
'exists' => $document_exists,
|
@@ -331,7 +331,7 @@ class Admin {
|
|
331 |
<input type="submit" class="button save_order button-primary" name="save" value="<?php esc_attr_e( 'Save order & send email', 'woocommerce-pdf-invoices-packing-slips' ); ?>" />
|
332 |
<?php
|
333 |
$title = __( 'Send email', 'woocommerce-pdf-invoices-packing-slips' );
|
334 |
-
$url = wp_nonce_url( add_query_arg( 'wpo_wcpdf_action', 'resend_email' ), 'generate_wpo_wcpdf' );
|
335 |
?>
|
336 |
</li>
|
337 |
</ul>
|
@@ -358,7 +358,7 @@ class Admin {
|
|
358 |
), admin_url( 'admin-ajax.php' ) ), 'generate_wpo_wcpdf' );
|
359 |
$document_title = is_callable( array( $document, 'get_title' ) ) ? $document->get_title() : $document_title;
|
360 |
$meta_box_actions[$document->get_type()] = array(
|
361 |
-
'url' => $pdf_url,
|
362 |
'alt' => "PDF " . $document_title,
|
363 |
'title' => "PDF " . $document_title,
|
364 |
'exists' => is_callable( array( $document, 'exists' ) ) ? $document->exists() : false,
|
@@ -455,7 +455,7 @@ class Admin {
|
|
455 |
<!-- Title -->
|
456 |
<h4>
|
457 |
<?php echo wp_kses_post( $document->get_title() ); ?>
|
458 |
-
<?php if( $document->exists() && ( isset( $data['number'] ) || isset( $data['date'] ) ) ) : ?>
|
459 |
<span class="wpo-wcpdf-edit-date-number dashicons dashicons-edit"></span>
|
460 |
<span class="wpo-wcpdf-delete-document dashicons dashicons-trash" data-action="delete" data-nonce="<?php echo wp_create_nonce( "wpo_wcpdf_delete_document" ); ?>"></span>
|
461 |
<?php do_action( 'wpo_wcpdf_document_actions', $document ); ?>
|
@@ -488,7 +488,14 @@ class Admin {
|
|
488 |
<?php do_action( 'wpo_wcpdf_meta_box_after_document_data', $document, $document->order ); ?>
|
489 |
<?php else : ?>
|
490 |
<?php /* translators: document title */ ?>
|
491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
<?php endif; ?>
|
493 |
</div>
|
494 |
|
@@ -516,7 +523,9 @@ class Admin {
|
|
516 |
<!-- Read only -->
|
517 |
<div class="read-only">
|
518 |
<span><strong><?= wp_kses_post( $data['notes']['label'] ); ?></strong></span>
|
519 |
-
|
|
|
|
|
520 |
<p><?= ( $data['notes']['value'] == strip_tags( $data['notes']['value'] ) ) ? wp_kses_post( nl2br( $data['notes']['value'] ) ) : wp_kses_post( $data['notes']['value'] ); ?></p>
|
521 |
</div>
|
522 |
<!-- Editable -->
|
@@ -600,6 +609,10 @@ class Admin {
|
|
600 |
if ( ! isset($_POST['action']) || $_POST['action'] != 'editpost' ) {
|
601 |
return;
|
602 |
}
|
|
|
|
|
|
|
|
|
603 |
|
604 |
$order = WCX::get_order( $post_id );
|
605 |
if ( $invoice = wcpdf_get_invoice( $order ) ) {
|
@@ -677,7 +690,7 @@ class Admin {
|
|
677 |
add_filter( 'redirect_post_location', function( $location ) {
|
678 |
// messages in includes/admin/class-wc-admin-post-types.php
|
679 |
// 11 => 'Order updated and sent.'
|
680 |
-
return add_query_arg( 'message', 11, $location );
|
681 |
} );
|
682 |
}
|
683 |
}
|
@@ -747,6 +760,10 @@ class Admin {
|
|
747 |
return $query_vars;
|
748 |
}
|
749 |
|
|
|
|
|
|
|
|
|
750 |
/**
|
751 |
* Save, regenerate or delete a document from AJAX request
|
752 |
*/
|
@@ -769,7 +786,7 @@ class Admin {
|
|
769 |
) );
|
770 |
}
|
771 |
|
772 |
-
if ( !
|
773 |
wp_send_json_error( array(
|
774 |
'message' => esc_html__( 'No permissions!', 'woocommerce-pdf-invoices-packing-slips' ),
|
775 |
) );
|
192 |
$document_exists = is_callable( array( $document, 'exists' ) ) ? $document->exists() : false;
|
193 |
|
194 |
$listing_actions[$document->get_type()] = array(
|
195 |
+
'url' => esc_url( $pdf_url ),
|
196 |
'img' => $icon,
|
197 |
'alt' => "PDF " . $document_title,
|
198 |
'exists' => $document_exists,
|
331 |
<input type="submit" class="button save_order button-primary" name="save" value="<?php esc_attr_e( 'Save order & send email', 'woocommerce-pdf-invoices-packing-slips' ); ?>" />
|
332 |
<?php
|
333 |
$title = __( 'Send email', 'woocommerce-pdf-invoices-packing-slips' );
|
334 |
+
$url = esc_url( wp_nonce_url( add_query_arg( 'wpo_wcpdf_action', 'resend_email' ), 'generate_wpo_wcpdf' ) );
|
335 |
?>
|
336 |
</li>
|
337 |
</ul>
|
358 |
), admin_url( 'admin-ajax.php' ) ), 'generate_wpo_wcpdf' );
|
359 |
$document_title = is_callable( array( $document, 'get_title' ) ) ? $document->get_title() : $document_title;
|
360 |
$meta_box_actions[$document->get_type()] = array(
|
361 |
+
'url' => esc_url( $pdf_url ),
|
362 |
'alt' => "PDF " . $document_title,
|
363 |
'title' => "PDF " . $document_title,
|
364 |
'exists' => is_callable( array( $document, 'exists' ) ) ? $document->exists() : false,
|
455 |
<!-- Title -->
|
456 |
<h4>
|
457 |
<?php echo wp_kses_post( $document->get_title() ); ?>
|
458 |
+
<?php if( $document->exists() && ( isset( $data['number'] ) || isset( $data['date'] ) ) && $this->user_can_manage_document( $document->get_type() ) ) : ?>
|
459 |
<span class="wpo-wcpdf-edit-date-number dashicons dashicons-edit"></span>
|
460 |
<span class="wpo-wcpdf-delete-document dashicons dashicons-trash" data-action="delete" data-nonce="<?php echo wp_create_nonce( "wpo_wcpdf_delete_document" ); ?>"></span>
|
461 |
<?php do_action( 'wpo_wcpdf_document_actions', $document ); ?>
|
488 |
<?php do_action( 'wpo_wcpdf_meta_box_after_document_data', $document, $document->order ); ?>
|
489 |
<?php else : ?>
|
490 |
<?php /* translators: document title */ ?>
|
491 |
+
<?php
|
492 |
+
if ( $this->user_can_manage_document( $document->get_type() ) ) {
|
493 |
+
printf( '<span class="wpo-wcpdf-set-date-number button">%s</span>', sprintf( esc_html__( 'Set %s number & date', 'woocommerce-pdf-invoices-packing-slips' ), wp_kses_post( $document->get_title() ) ) );
|
494 |
+
} else {
|
495 |
+
printf( '<p>%s</p>', esc_html__( 'You do not have sufficient permissions to edit this document.', 'woocommerce-pdf-invoices-packing-slips' ) );
|
496 |
+
}
|
497 |
+
?>
|
498 |
+
|
499 |
<?php endif; ?>
|
500 |
</div>
|
501 |
|
523 |
<!-- Read only -->
|
524 |
<div class="read-only">
|
525 |
<span><strong><?= wp_kses_post( $data['notes']['label'] ); ?></strong></span>
|
526 |
+
<?php if ( $this->user_can_manage_document( $document->get_type() ) ) : ?>
|
527 |
+
<span class="wpo-wcpdf-edit-document-notes dashicons dashicons-edit" data-edit="notes"></span>
|
528 |
+
<?php endif; ?>
|
529 |
<p><?= ( $data['notes']['value'] == strip_tags( $data['notes']['value'] ) ) ? wp_kses_post( nl2br( $data['notes']['value'] ) ) : wp_kses_post( $data['notes']['value'] ); ?></p>
|
530 |
</div>
|
531 |
<!-- Editable -->
|
609 |
if ( ! isset($_POST['action']) || $_POST['action'] != 'editpost' ) {
|
610 |
return;
|
611 |
}
|
612 |
+
// Check if user is allowed to change invoice data
|
613 |
+
if ( ! $this->user_can_manage_document( 'invoice' ) ) {
|
614 |
+
return;
|
615 |
+
}
|
616 |
|
617 |
$order = WCX::get_order( $post_id );
|
618 |
if ( $invoice = wcpdf_get_invoice( $order ) ) {
|
690 |
add_filter( 'redirect_post_location', function( $location ) {
|
691 |
// messages in includes/admin/class-wc-admin-post-types.php
|
692 |
// 11 => 'Order updated and sent.'
|
693 |
+
return esc_url_raw( add_query_arg( 'message', 11, $location ) );
|
694 |
} );
|
695 |
}
|
696 |
}
|
760 |
return $query_vars;
|
761 |
}
|
762 |
|
763 |
+
public function user_can_manage_document( $document_type ) {
|
764 |
+
return apply_filters( 'wpo_wcpdf_current_user_is_allowed', ( current_user_can( 'manage_woocommerce_orders' ) || current_user_can( 'edit_shop_orders' ) ), $document_type );
|
765 |
+
}
|
766 |
+
|
767 |
/**
|
768 |
* Save, regenerate or delete a document from AJAX request
|
769 |
*/
|
786 |
) );
|
787 |
}
|
788 |
|
789 |
+
if ( ! $this->user_can_manage_document( sanitize_text_field( $_POST['document_type'] ) ) ) {
|
790 |
wp_send_json_error( array(
|
791 |
'message' => esc_html__( 'No permissions!', 'woocommerce-pdf-invoices-packing-slips' ),
|
792 |
) );
|
includes/class-wcpdf-font-synchronizer.php
CHANGED
@@ -105,11 +105,11 @@ class Font_Synchronizer {
|
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
-
*
|
109 |
*
|
110 |
-
* @param
|
111 |
-
* @param
|
112 |
-
* @return
|
113 |
*/
|
114 |
public function copy_font_files( $filenames, $destination ) {
|
115 |
$destination = trailingslashit( $destination );
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
+
* Copy font files
|
109 |
*
|
110 |
+
* @param array $filenames array of filenames without the extension
|
111 |
+
* @param string $destination path to the local fonts
|
112 |
+
* @return array
|
113 |
*/
|
114 |
public function copy_font_files( $filenames, $destination ) {
|
115 |
$destination = trailingslashit( $destination );
|
includes/class-wcpdf-frontend.php
CHANGED
@@ -60,7 +60,7 @@ class Frontend {
|
|
60 |
// Check if invoice has been created already or if status allows download (filter your own array of allowed statuses)
|
61 |
if ( $invoice_allowed || in_array( WCX_Order::get_status( $order ), apply_filters( 'wpo_wcpdf_myaccount_allowed_order_statuses', array() ) ) ) {
|
62 |
$actions['invoice'] = array(
|
63 |
-
'url' => $pdf_url,
|
64 |
'name' => apply_filters( 'wpo_wcpdf_myaccount_button_text', $invoice->get_title(), $invoice )
|
65 |
);
|
66 |
}
|
@@ -100,8 +100,8 @@ class Frontend {
|
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
return $data;
|
104 |
$this->restore_storing_document_settings();
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -163,7 +163,7 @@ class Frontend {
|
|
163 |
return; // no business here
|
164 |
}
|
165 |
|
166 |
-
$pdf_url = wp_nonce_url( add_query_arg( $query_args, admin_url( 'admin-ajax.php' ) ), 'generate_wpo_wcpdf' );
|
167 |
$text = sprintf( '<p><a href="%s" target="_blank">%s</a></p>', esc_attr( $pdf_url ), esc_html( $link_text ) );
|
168 |
|
169 |
return $text;
|
60 |
// Check if invoice has been created already or if status allows download (filter your own array of allowed statuses)
|
61 |
if ( $invoice_allowed || in_array( WCX_Order::get_status( $order ), apply_filters( 'wpo_wcpdf_myaccount_allowed_order_statuses', array() ) ) ) {
|
62 |
$actions['invoice'] = array(
|
63 |
+
'url' => esc_url( $pdf_url ),
|
64 |
'name' => apply_filters( 'wpo_wcpdf_myaccount_button_text', $invoice->get_title(), $invoice )
|
65 |
);
|
66 |
}
|
100 |
}
|
101 |
}
|
102 |
|
|
|
103 |
$this->restore_storing_document_settings();
|
104 |
+
return $data;
|
105 |
}
|
106 |
|
107 |
/**
|
163 |
return; // no business here
|
164 |
}
|
165 |
|
166 |
+
$pdf_url = esc_url( wp_nonce_url( add_query_arg( $query_args, admin_url( 'admin-ajax.php' ) ), 'generate_wpo_wcpdf' ) );
|
167 |
$text = sprintf( '<p><a href="%s" target="_blank">%s</a></p>', esc_attr( $pdf_url ), esc_html( $link_text ) );
|
168 |
|
169 |
return $text;
|
includes/class-wcpdf-main.php
CHANGED
@@ -316,20 +316,20 @@ class Main {
|
|
316 |
}
|
317 |
|
318 |
// Check the user privileges
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
// User call from my-account page
|
324 |
-
if ( !current_user_can('manage_options') && isset( $_GET['my-account'] ) ) {
|
325 |
-
// Only for single orders!
|
326 |
-
if ( count( $order_ids ) > 1 ) {
|
327 |
-
$allowed = false;
|
328 |
-
}
|
329 |
-
|
330 |
-
// Check if current user is owner of order IMPORTANT!!!
|
331 |
-
if ( ! current_user_can( 'view_order', $order_ids[0] ) ) {
|
332 |
$allowed = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
}
|
334 |
}
|
335 |
}
|
316 |
}
|
317 |
|
318 |
// Check the user privileges
|
319 |
+
$full_permission = WPO_WCPDF()->admin->user_can_manage_document( $document_type );
|
320 |
+
if ( ! $full_permission ) {
|
321 |
+
if ( ! isset( $_GET['my-account'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
$allowed = false;
|
323 |
+
} else { // User call from my-account page
|
324 |
+
// Only for single orders!
|
325 |
+
if ( count( $order_ids ) > 1 ) {
|
326 |
+
$allowed = false;
|
327 |
+
}
|
328 |
+
|
329 |
+
// Check if current user is owner of order IMPORTANT!!!
|
330 |
+
if ( ! current_user_can( 'view_order', $order_ids[0] ) ) {
|
331 |
+
$allowed = false;
|
332 |
+
}
|
333 |
}
|
334 |
}
|
335 |
}
|
includes/class-wcpdf-settings-callbacks.php
CHANGED
@@ -195,7 +195,7 @@ class Settings_Callbacks {
|
|
195 |
*
|
196 |
* @param array $args Field arguments.
|
197 |
*
|
198 |
-
* @return
|
199 |
*/
|
200 |
public function select( $args ) {
|
201 |
extract( $this->normalize_settings_args( $args ) );
|
@@ -293,7 +293,7 @@ class Settings_Callbacks {
|
|
293 |
/**
|
294 |
* Multiple text element callback.
|
295 |
* @param array $args Field arguments.
|
296 |
-
* @return
|
297 |
*/
|
298 |
public function multiple_text_input( $args ) {
|
299 |
extract( $this->normalize_settings_args( $args ) );
|
@@ -340,7 +340,7 @@ class Settings_Callbacks {
|
|
340 |
/**
|
341 |
* Multiple text element callback.
|
342 |
* @param array $args Field arguments.
|
343 |
-
* @return
|
344 |
*/
|
345 |
public function multiple_checkboxes( $args ) {
|
346 |
extract( $this->normalize_settings_args( $args ) );
|
@@ -369,8 +369,7 @@ class Settings_Callbacks {
|
|
369 |
* Media upload callback.
|
370 |
*
|
371 |
* @param array $args Field arguments.
|
372 |
-
*
|
373 |
-
* @return string Media upload button & preview.
|
374 |
*/
|
375 |
public function media_upload( $args ) {
|
376 |
extract( $this->normalize_settings_args( $args ) );
|
@@ -474,9 +473,8 @@ class Settings_Callbacks {
|
|
474 |
|
475 |
/**
|
476 |
* Wrapper function to create tabs for settings in different languages
|
477 |
-
* @param
|
478 |
-
* @
|
479 |
-
* @return [type] [description]
|
480 |
*/
|
481 |
public function i18n_wrap ( $args ) {
|
482 |
extract( $this->normalize_settings_args( $args ) );
|
195 |
*
|
196 |
* @param array $args Field arguments.
|
197 |
*
|
198 |
+
* @return void
|
199 |
*/
|
200 |
public function select( $args ) {
|
201 |
extract( $this->normalize_settings_args( $args ) );
|
293 |
/**
|
294 |
* Multiple text element callback.
|
295 |
* @param array $args Field arguments.
|
296 |
+
* @return void
|
297 |
*/
|
298 |
public function multiple_text_input( $args ) {
|
299 |
extract( $this->normalize_settings_args( $args ) );
|
340 |
/**
|
341 |
* Multiple text element callback.
|
342 |
* @param array $args Field arguments.
|
343 |
+
* @return void
|
344 |
*/
|
345 |
public function multiple_checkboxes( $args ) {
|
346 |
extract( $this->normalize_settings_args( $args ) );
|
369 |
* Media upload callback.
|
370 |
*
|
371 |
* @param array $args Field arguments.
|
372 |
+
* @return void
|
|
|
373 |
*/
|
374 |
public function media_upload( $args ) {
|
375 |
extract( $this->normalize_settings_args( $args ) );
|
473 |
|
474 |
/**
|
475 |
* Wrapper function to create tabs for settings in different languages
|
476 |
+
* @param array $args
|
477 |
+
* @return void
|
|
|
478 |
*/
|
479 |
public function i18n_wrap ( $args ) {
|
480 |
extract( $this->normalize_settings_args( $args ) );
|
includes/class-wcpdf-settings-documents.php
CHANGED
@@ -44,7 +44,7 @@ class Settings_Documents {
|
|
44 |
$title = '['.__( 'untitled', 'woocommerce-pdf-invoices-packing-slips' ).']';
|
45 |
}
|
46 |
$active = $document->get_type() == $section ? 'active' : '';
|
47 |
-
printf( '<li class="%2$s"><a href="%1$s" class="%2$s">%3$s</a></li>', add_query_arg( 'section', $document->get_type() ), $active, esc_html( $title ) );
|
48 |
}
|
49 |
}
|
50 |
?>
|
44 |
$title = '['.__( 'untitled', 'woocommerce-pdf-invoices-packing-slips' ).']';
|
45 |
}
|
46 |
$active = $document->get_type() == $section ? 'active' : '';
|
47 |
+
printf( '<li class="%2$s"><a href="%1$s" class="%2$s">%3$s</a></li>', esc_url( add_query_arg( 'section', $document->get_type() ) ), $active, esc_html( $title ) );
|
48 |
}
|
49 |
}
|
50 |
?>
|
includes/class-wcpdf-settings-general.php
CHANGED
@@ -302,7 +302,7 @@ class Settings_General {
|
|
302 |
$installed_templates = array();
|
303 |
|
304 |
// get base paths
|
305 |
-
$template_base_path = ( function_exists( 'WC' ) && is_callable( 'WC', 'template_path' ) ) ? WC()->template_path() : 'woocommerce/';
|
306 |
$template_base_path = untrailingslashit( $template_base_path );
|
307 |
$template_paths = array (
|
308 |
// note the order: child-theme before theme, so that array_unique filters out parent doubles
|
302 |
$installed_templates = array();
|
303 |
|
304 |
// get base paths
|
305 |
+
$template_base_path = ( function_exists( 'WC' ) && is_callable( array( 'WC', 'template_path' ) ) ) ? WC()->template_path() : 'woocommerce/';
|
306 |
$template_base_path = untrailingslashit( $template_base_path );
|
307 |
$template_paths = array (
|
308 |
// note the order: child-theme before theme, so that array_unique filters out parent doubles
|
includes/class-wcpdf-settings.php
CHANGED
@@ -482,7 +482,7 @@ class Settings {
|
|
482 |
$installed_templates = array();
|
483 |
|
484 |
// get base paths
|
485 |
-
$template_base_path = ( function_exists( 'WC' ) && is_callable( 'WC', 'template_path' ) ) ? WC()->template_path() : 'woocommerce/';
|
486 |
$template_base_path = untrailingslashit( $template_base_path );
|
487 |
$template_paths = array (
|
488 |
// note the order: theme before child-theme, so that child theme is always preferred (overwritten)
|
482 |
$installed_templates = array();
|
483 |
|
484 |
// get base paths
|
485 |
+
$template_base_path = ( function_exists( 'WC' ) && is_callable( array( 'WC', 'template_path' ) ) ) ? WC()->template_path() : 'woocommerce/';
|
486 |
$template_base_path = untrailingslashit( $template_base_path );
|
487 |
$template_paths = array (
|
488 |
// note the order: theme before child-theme, so that child theme is always preferred (overwritten)
|
includes/class-wcpdf-setup-wizard.php
CHANGED
@@ -207,7 +207,7 @@ class Setup_Wizard {
|
|
207 |
if ( end( $step_keys ) === $this->step && empty( $step ) ) {
|
208 |
return admin_url('admin.php?page=wpo_wcpdf_options_page');
|
209 |
}
|
210 |
-
return add_query_arg( 'step', $step );
|
211 |
}
|
212 |
|
213 |
|
207 |
if ( end( $step_keys ) === $this->step && empty( $step ) ) {
|
208 |
return admin_url('admin.php?page=wpo_wcpdf_options_page');
|
209 |
}
|
210 |
+
return esc_url( add_query_arg( 'step', $step ) );
|
211 |
}
|
212 |
|
213 |
|
includes/compatibility/abstract-wc-data-compatibility.php
CHANGED
@@ -154,10 +154,10 @@ abstract class Data {
|
|
154 |
* Updates an object's stored meta value.
|
155 |
*
|
156 |
* @since 4.6.0-dev
|
157 |
-
* @param \WC_Data
|
158 |
-
* @param string
|
159 |
-
* @param string $value the meta value
|
160 |
-
* @param int|
|
161 |
*/
|
162 |
public static function update_meta_data( $object, $key, $value, $meta_id = '' ) {
|
163 |
|
154 |
* Updates an object's stored meta value.
|
155 |
*
|
156 |
* @since 4.6.0-dev
|
157 |
+
* @param \WC_Data $object the data object, likely \WC_Order or \WC_Product
|
158 |
+
* @param string $key the meta key
|
159 |
+
* @param string|array $value the meta value
|
160 |
+
* @param int|string $meta_id Optional. The specific meta ID to update
|
161 |
*/
|
162 |
public static function update_meta_data( $object, $key, $value, $meta_id = '' ) {
|
163 |
|
includes/documents/abstract-wcpdf-order-document-methods.php
CHANGED
@@ -735,8 +735,8 @@ abstract class Order_Document_Methods extends Order_Document {
|
|
735 |
|
736 |
/**
|
737 |
* Returns the percentage rate (float) for a given tax rate ID.
|
738 |
-
* @param int
|
739 |
-
* @return float $rate percentage rate
|
740 |
*/
|
741 |
public function get_tax_rate_by_id( $rate_id, $order = null ) {
|
742 |
global $wpdb;
|
@@ -1227,7 +1227,7 @@ abstract class Order_Document_Methods extends Order_Document {
|
|
1227 |
*/
|
1228 |
public function get_formatted_item_price ( $item, $type, $tax_display = '' ) {
|
1229 |
if ( ! isset( $item['line_subtotal'] ) || ! isset( $item['line_subtotal_tax'] ) ) {
|
1230 |
-
return;
|
1231 |
}
|
1232 |
|
1233 |
$divide_by = ($type == 'single' && $item['qty'] != 0 )?abs($item['qty']):1; //divide by 1 if $type is not 'single' (thus 'total')
|
735 |
|
736 |
/**
|
737 |
* Returns the percentage rate (float) for a given tax rate ID.
|
738 |
+
* @param int $rate_id woocommerce tax rate id
|
739 |
+
* @return float|bool $rate percentage rate
|
740 |
*/
|
741 |
public function get_tax_rate_by_id( $rate_id, $order = null ) {
|
742 |
global $wpdb;
|
1227 |
*/
|
1228 |
public function get_formatted_item_price ( $item, $type, $tax_display = '' ) {
|
1229 |
if ( ! isset( $item['line_subtotal'] ) || ! isset( $item['line_subtotal_tax'] ) ) {
|
1230 |
+
return '';
|
1231 |
}
|
1232 |
|
1233 |
$divide_by = ($type == 'single' && $item['qty'] != 0 )?abs($item['qty']):1; //divide by 1 if $type is not 'single' (thus 'total')
|
includes/documents/abstract-wcpdf-order-document.php
CHANGED
@@ -740,7 +740,7 @@ abstract class Order_Document {
|
|
740 |
do_action( 'wpo_wcpdf_before_pdf', $this->get_type(), $this );
|
741 |
|
742 |
// temporarily apply filters that need to be removed again after the pdf is generated
|
743 |
-
$pdf_filters = apply_filters( 'wpo_wcpdf_pdf_filters', array() );
|
744 |
$this->add_filters( $pdf_filters );
|
745 |
|
746 |
$pdf_settings = array(
|
@@ -780,7 +780,7 @@ abstract class Order_Document {
|
|
780 |
do_action( 'wpo_wcpdf_before_html', $this->get_type(), $this );
|
781 |
|
782 |
// temporarily apply filters that need to be removed again after the html is generated
|
783 |
-
$html_filters = apply_filters( 'wpo_wcpdf_html_filters', array() );
|
784 |
$this->add_filters( $html_filters );
|
785 |
|
786 |
$default_args = array (
|
@@ -1068,7 +1068,7 @@ abstract class Order_Document {
|
|
1068 |
$default_table_name = $this->get_number_store_table_default_name( $store_base_name, $method );
|
1069 |
$now = new \WC_DateTime( 'now', new \DateTimeZone( 'UTC' ) );
|
1070 |
$current_year = intval( $now->date_i18n( 'Y' ) );
|
1071 |
-
$current_store_year = $this->get_number_store_year( $default_table_name );
|
1072 |
$requested_year = intval( $date->date_i18n( 'Y' ) );
|
1073 |
|
1074 |
// nothing to retire if requested year matches current store year or if current store year is not in the past
|
740 |
do_action( 'wpo_wcpdf_before_pdf', $this->get_type(), $this );
|
741 |
|
742 |
// temporarily apply filters that need to be removed again after the pdf is generated
|
743 |
+
$pdf_filters = apply_filters( 'wpo_wcpdf_pdf_filters', array(), $this );
|
744 |
$this->add_filters( $pdf_filters );
|
745 |
|
746 |
$pdf_settings = array(
|
780 |
do_action( 'wpo_wcpdf_before_html', $this->get_type(), $this );
|
781 |
|
782 |
// temporarily apply filters that need to be removed again after the html is generated
|
783 |
+
$html_filters = apply_filters( 'wpo_wcpdf_html_filters', array(), $this );
|
784 |
$this->add_filters( $html_filters );
|
785 |
|
786 |
$default_args = array (
|
1068 |
$default_table_name = $this->get_number_store_table_default_name( $store_base_name, $method );
|
1069 |
$now = new \WC_DateTime( 'now', new \DateTimeZone( 'UTC' ) );
|
1070 |
$current_year = intval( $now->date_i18n( 'Y' ) );
|
1071 |
+
$current_store_year = intval( $this->get_number_store_year( $default_table_name ) );
|
1072 |
$requested_year = intval( $date->date_i18n( 'Y' ) );
|
1073 |
|
1074 |
// nothing to retire if requested year matches current store year or if current store year is not in the past
|
includes/documents/class-wcpdf-bulk-document.php
CHANGED
@@ -55,7 +55,7 @@ class Bulk_Document {
|
|
55 |
do_action( 'wpo_wcpdf_before_pdf', $this->get_type(), $this );
|
56 |
|
57 |
// temporarily apply filters that need to be removed again after the pdf is generated
|
58 |
-
$pdf_filters = apply_filters( 'wpo_wcpdf_pdf_filters', array() );
|
59 |
$this->add_filters( $pdf_filters );
|
60 |
|
61 |
$html = $this->get_html();
|
@@ -79,7 +79,7 @@ class Bulk_Document {
|
|
79 |
do_action( 'wpo_wcpdf_before_html', $this->get_type(), $this );
|
80 |
|
81 |
// temporarily apply filters that need to be removed again after the html is generated
|
82 |
-
$html_filters = apply_filters( 'wpo_wcpdf_html_filters', array() );
|
83 |
$this->add_filters( $html_filters );
|
84 |
|
85 |
$html_content = array();
|
55 |
do_action( 'wpo_wcpdf_before_pdf', $this->get_type(), $this );
|
56 |
|
57 |
// temporarily apply filters that need to be removed again after the pdf is generated
|
58 |
+
$pdf_filters = apply_filters( 'wpo_wcpdf_pdf_filters', array(), $this );
|
59 |
$this->add_filters( $pdf_filters );
|
60 |
|
61 |
$html = $this->get_html();
|
79 |
do_action( 'wpo_wcpdf_before_html', $this->get_type(), $this );
|
80 |
|
81 |
// temporarily apply filters that need to be removed again after the html is generated
|
82 |
+
$html_filters = apply_filters( 'wpo_wcpdf_html_filters', array(), $this );
|
83 |
$this->add_filters( $html_filters );
|
84 |
|
85 |
$html_content = array();
|
includes/documents/class-wcpdf-invoice.php
CHANGED
@@ -106,7 +106,7 @@ class Invoice extends Order_Document_Methods {
|
|
106 |
}
|
107 |
|
108 |
$number_store = $this->get_sequential_number_store();
|
109 |
-
$invoice_number = $number_store->increment( $this->order_id, $this->get_date()->date_i18n( 'Y-m-d H:i:s' ) );
|
110 |
|
111 |
$this->set_number( $invoice_number );
|
112 |
|
106 |
}
|
107 |
|
108 |
$number_store = $this->get_sequential_number_store();
|
109 |
+
$invoice_number = $number_store->increment( intval( $this->order_id ), $this->get_date()->date_i18n( 'Y-m-d H:i:s' ) );
|
110 |
|
111 |
$this->set_number( $invoice_number );
|
112 |
|
includes/views/attachment-settings-hint.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php defined( 'ABSPATH' ) or exit; ?>
|
2 |
<?php
|
3 |
-
$invoice_settings_url = add_query_arg( array(
|
4 |
'tab' => 'documents',
|
5 |
'section' => 'invoice',
|
6 |
-
) );
|
7 |
?>
|
8 |
<div class="wcpdf-attachment-settings-hint notice inline">
|
9 |
<p>
|
10 |
<?php /* translators: <a> tags */ ?>
|
11 |
<?php printf( wp_kses_post( __( 'It looks like you haven\'t setup any email attachments yet, check the settings under <b>%1$sDocuments > Invoice%2$s</b>', 'woocommerce-pdf-invoices-packing-slips' ) ), '<a href="'.$invoice_settings_url.'">', '</a>' ); ?>
|
12 |
-
<?php printf( '<a href="%s" style="display:block; margin-top:10px;">%s</a>', add_query_arg( 'wpo_wcpdf_hide_attachments_hint', 'true' ), esc_html__( 'Hide this message', 'woocommerce-pdf-invoices-packing-slips' ) ); ?>
|
13 |
</p>
|
14 |
</div>
|
1 |
<?php defined( 'ABSPATH' ) or exit; ?>
|
2 |
<?php
|
3 |
+
$invoice_settings_url = esc_url( add_query_arg( array(
|
4 |
'tab' => 'documents',
|
5 |
'section' => 'invoice',
|
6 |
+
) ) );
|
7 |
?>
|
8 |
<div class="wcpdf-attachment-settings-hint notice inline">
|
9 |
<p>
|
10 |
<?php /* translators: <a> tags */ ?>
|
11 |
<?php printf( wp_kses_post( __( 'It looks like you haven\'t setup any email attachments yet, check the settings under <b>%1$sDocuments > Invoice%2$s</b>', 'woocommerce-pdf-invoices-packing-slips' ) ), '<a href="'.$invoice_settings_url.'">', '</a>' ); ?>
|
12 |
+
<?php printf( '<a href="%s" style="display:block; margin-top:10px;">%s</a>', esc_url( add_query_arg( 'wpo_wcpdf_hide_attachments_hint', 'true' ) ), esc_html__( 'Hide this message', 'woocommerce-pdf-invoices-packing-slips' ) ); ?>
|
13 |
</p>
|
14 |
</div>
|
includes/views/wcpdf-settings-page.php
CHANGED
@@ -66,8 +66,8 @@ $review_invitation = sprintf(
|
|
66 |
</div>
|
67 |
|
68 |
<div class="gutter">
|
69 |
-
<div class="slider slide-left"
|
70 |
-
<div class="slider slide-right"
|
71 |
</div>
|
72 |
|
73 |
<div class="preview-document">
|
66 |
</div>
|
67 |
|
68 |
<div class="gutter">
|
69 |
+
<div class="slider slide-left"><span class="gutter-arrow arrow-left"></span></div>
|
70 |
+
<div class="slider slide-right"><span class="gutter-arrow arrow-right"></span></div>
|
71 |
</div>
|
72 |
|
73 |
<div class="preview-document">
|
includes/wcpdf-functions.php
CHANGED
@@ -119,7 +119,7 @@ function wcpdf_get_packing_slip( $order, $init = false ) {
|
|
119 |
*
|
120 |
* @param string $html
|
121 |
* @param array $settings
|
122 |
-
* @return PDF_Maker
|
123 |
*/
|
124 |
function wcpdf_get_pdf_maker( $html, $settings = array() ) {
|
125 |
if ( ! class_exists( '\\WPO\\WC\\PDF_Invoices\\PDF_Maker' ) ) {
|
119 |
*
|
120 |
* @param string $html
|
121 |
* @param array $settings
|
122 |
+
* @return WPO\WC\PDF_Invoices\PDF_Maker
|
123 |
*/
|
124 |
function wcpdf_get_pdf_maker( $html, $settings = array() ) {
|
125 |
if ( ! class_exists( '\\WPO\\WC\\PDF_Invoices\\PDF_Maker' ) ) {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice,
|
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 7.1
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -102,6 +102,13 @@ There's a setting on the Status tab of the settings page that allows you to togg
|
|
102 |
|
103 |
== Changelog ==
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
= 2.14.5 =
|
106 |
* Fix: Preview invoice number & date display settings
|
107 |
* Tested up to WooCommerce 6.5 & WordPress 6.0
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 7.1
|
8 |
+
Stable tag: 2.15.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
102 |
|
103 |
== Changelog ==
|
104 |
|
105 |
+
= 2.15.0 =
|
106 |
+
* New: Filter hooks to override ability to edit document data
|
107 |
+
* Simple template: Only show shipping & payment method lines when set
|
108 |
+
* Security: escape urls as late as possible
|
109 |
+
* Fix: WP6.0+ converting interface elements to emojis
|
110 |
+
* Tweak: Show sticky save button for all setting changes
|
111 |
+
|
112 |
= 2.14.5 =
|
113 |
* Fix: Preview invoice number & date display settings
|
114 |
* Tested up to WooCommerce 6.5 & WordPress 6.0
|
templates/Simple/invoice.php
CHANGED
@@ -80,10 +80,12 @@
|
|
80 |
<th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
81 |
<td><?php $this->order_date(); ?></td>
|
82 |
</tr>
|
|
|
83 |
<tr class="payment-method">
|
84 |
<th><?php _e( 'Payment Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
85 |
-
<td><?php $
|
86 |
</tr>
|
|
|
87 |
<?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?>
|
88 |
</table>
|
89 |
</td>
|
80 |
<th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
81 |
<td><?php $this->order_date(); ?></td>
|
82 |
</tr>
|
83 |
+
<?php if ( $payment_method = $this->get_payment_method() ) : ?>
|
84 |
<tr class="payment-method">
|
85 |
<th><?php _e( 'Payment Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
86 |
+
<td><?php echo $payment_method; ?></td>
|
87 |
</tr>
|
88 |
+
<?php endif; ?>
|
89 |
<?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?>
|
90 |
</table>
|
91 |
</td>
|
templates/Simple/packing-slip.php
CHANGED
@@ -68,10 +68,12 @@
|
|
68 |
<th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
69 |
<td><?php $this->order_date(); ?></td>
|
70 |
</tr>
|
|
|
71 |
<tr class="shipping-method">
|
72 |
<th><?php _e( 'Shipping Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
73 |
-
<td><?php $
|
74 |
</tr>
|
|
|
75 |
<?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?>
|
76 |
</table>
|
77 |
</td>
|
68 |
<th><?php _e( 'Order Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
69 |
<td><?php $this->order_date(); ?></td>
|
70 |
</tr>
|
71 |
+
<?php if ( $shipping_method = $this->get_shipping_method() ) : ?>
|
72 |
<tr class="shipping-method">
|
73 |
<th><?php _e( 'Shipping Method:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
|
74 |
+
<td><?php echo $shipping_method; ?></td>
|
75 |
</tr>
|
76 |
+
<?php endif; ?>
|
77 |
<?php do_action( 'wpo_wcpdf_after_order_data', $this->get_type(), $this->order ); ?>
|
78 |
</table>
|
79 |
</td>
|
woocommerce-pdf-invoices-packingslips.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* Plugin Name: WooCommerce PDF Invoices & Packing Slips
|
4 |
* Plugin URI: https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/
|
5 |
* Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
|
6 |
-
* Version: 2.
|
7 |
* Author: WP Overnight
|
8 |
* Author URI: https://www.wpovernight.com
|
9 |
* License: GPLv2 or later
|
10 |
* License URI: https://opensource.org/licenses/gpl-license.php
|
11 |
* Text Domain: woocommerce-pdf-invoices-packing-slips
|
12 |
* WC requires at least: 2.2.0
|
13 |
-
* WC tested up to: 6.
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -21,7 +21,7 @@ if ( !class_exists( 'WPO_WCPDF' ) ) :
|
|
21 |
|
22 |
class WPO_WCPDF {
|
23 |
|
24 |
-
public $version = '2.
|
25 |
public $plugin_basename;
|
26 |
public $legacy_mode;
|
27 |
public $legacy_textdomain;
|
@@ -189,7 +189,7 @@ class WPO_WCPDF {
|
|
189 |
$this->documents = include_once( $this->plugin_path() . '/includes/class-wcpdf-documents.php' );
|
190 |
$this->main = include_once( $this->plugin_path() . '/includes/class-wcpdf-main.php' );
|
191 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-assets.php' );
|
192 |
-
include_once( $this->plugin_path() . '/includes/class-wcpdf-admin.php' );
|
193 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-frontend.php' );
|
194 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-install.php' );
|
195 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-font-synchronizer.php' );
|
@@ -262,7 +262,7 @@ class WPO_WCPDF {
|
|
262 |
/**
|
263 |
* WooCommerce not active notice.
|
264 |
*
|
265 |
-
* @return
|
266 |
*/
|
267 |
public function need_woocommerce() {
|
268 |
/* translators: <a> tags */
|
@@ -334,7 +334,7 @@ class WPO_WCPDF {
|
|
334 |
$current_version_parts = explode( '.', $this->version );
|
335 |
|
336 |
if ( 3 !== sizeof( $notice_version_parts ) ) {
|
337 |
-
return;
|
338 |
}
|
339 |
|
340 |
$notice_version = $notice_version_parts[0] . '.' . $notice_version_parts[1];
|
3 |
* Plugin Name: WooCommerce PDF Invoices & Packing Slips
|
4 |
* Plugin URI: https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/
|
5 |
* Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
|
6 |
+
* Version: 2.15.0
|
7 |
* Author: WP Overnight
|
8 |
* Author URI: https://www.wpovernight.com
|
9 |
* License: GPLv2 or later
|
10 |
* License URI: https://opensource.org/licenses/gpl-license.php
|
11 |
* Text Domain: woocommerce-pdf-invoices-packing-slips
|
12 |
* WC requires at least: 2.2.0
|
13 |
+
* WC tested up to: 6.6
|
14 |
*/
|
15 |
|
16 |
if ( ! defined( 'ABSPATH' ) ) {
|
21 |
|
22 |
class WPO_WCPDF {
|
23 |
|
24 |
+
public $version = '2.15.0';
|
25 |
public $plugin_basename;
|
26 |
public $legacy_mode;
|
27 |
public $legacy_textdomain;
|
189 |
$this->documents = include_once( $this->plugin_path() . '/includes/class-wcpdf-documents.php' );
|
190 |
$this->main = include_once( $this->plugin_path() . '/includes/class-wcpdf-main.php' );
|
191 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-assets.php' );
|
192 |
+
$this->admin = include_once( $this->plugin_path() . '/includes/class-wcpdf-admin.php' );
|
193 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-frontend.php' );
|
194 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-install.php' );
|
195 |
include_once( $this->plugin_path() . '/includes/class-wcpdf-font-synchronizer.php' );
|
262 |
/**
|
263 |
* WooCommerce not active notice.
|
264 |
*
|
265 |
+
* @return void
|
266 |
*/
|
267 |
public function need_woocommerce() {
|
268 |
/* translators: <a> tags */
|
334 |
$current_version_parts = explode( '.', $this->version );
|
335 |
|
336 |
if ( 3 !== sizeof( $notice_version_parts ) ) {
|
337 |
+
return $upgrade_notice;
|
338 |
}
|
339 |
|
340 |
$notice_version = $notice_version_parts[0] . '.' . $notice_version_parts[1];
|