From 0a1436d430511e9752c868f659f02de43e838bb3 Mon Sep 17 00:00:00 2001 From: Mohamad <136313810+MohamadNateqi@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:19:51 +0330 Subject: [PATCH 1/5] New: added sections to settings for better organization (#849) --- assets/css/settings-styles.css | 146 ++++++++------ assets/css/settings-styles.min.css | 2 +- assets/js/admin-script.js | 30 ++- assets/js/admin-script.min.js | 2 +- includes/Documents/Invoice.php | 72 +++++++ includes/Documents/PackingSlip.php | 45 ++++- includes/Settings.php | 229 +++++++++++++++++++++- woocommerce-pdf-invoices-packingslips.php | 4 +- 8 files changed, 460 insertions(+), 70 deletions(-) diff --git a/assets/css/settings-styles.css b/assets/css/settings-styles.css index 7393c06da..a883b8c46 100644 --- a/assets/css/settings-styles.css +++ b/assets/css/settings-styles.css @@ -206,7 +206,8 @@ table.wcpdf_documents_settings_list td.title { cursor: pointer; padding: 1em 0.8em; margin: 0; - border: 1px solid #eaeaea; + border: 1px solid #c3c4c7; + background: #ffffff; } .wcpdf_document_settings_sections ul { @@ -220,8 +221,8 @@ table.wcpdf_documents_settings_list td.title { display: none; box-sizing: border-box; position: absolute; - border-left: 1px solid #eaeaea; - border-right: 1px solid #eaeaea; + border-left: 1px solid #c3c4c7; + border-right: 1px solid #c3c4c7; z-index: 1000; box-shadow: 0 35px 35px -8px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 35px 35px -8px rgba(0, 0, 0, 0.1); @@ -239,6 +240,10 @@ table.wcpdf_documents_settings_list td.title { font-size: 1.1em; } +.wcpdf_document_settings_sections ul li:last-child { + border-color: #c3c4c7; +} + .wcpdf_document_settings_sections ul li:hover { cursor: pointer; background: #51266b; @@ -304,7 +309,7 @@ table.wcpdf_documents_settings_list td.title { /* Preview */ body.woocommerce_page_wpo_wcpdf_options_page { - background: #fff; + background: #fdfdfd; } .wrap [class$="icon32"] + h2 { @@ -366,9 +371,6 @@ body.woocommerce_page_wpo_wcpdf_options_page { } #wpo-wcpdf-preview-wrapper .sidebar .form-table, -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr, -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > th, -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td, #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 > th, @@ -378,29 +380,22 @@ body.woocommerce_page_wpo_wcpdf_options_page { padding: 0; } -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > th, #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > th { padding-bottom: 0.6em; } -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td, -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td { +#wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr:not(:last-child) > td { padding-bottom: 2.4em; } -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td > p.description, #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td p.description { font-size: 0.85em; padding-top: 0.7em; } -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td > input[type="text"], #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td > input[type="text"], -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td > input[type="url"], #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td > input[type="url"], -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td > select, #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td > select, -#wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td > textarea, #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td > textarea { max-width: none; width: 100%; @@ -416,44 +411,63 @@ body.woocommerce_page_wpo_wcpdf_options_page { 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 > 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="3"][data-preview-state="closed"] .sidebar .form-table > tbody > tr { + display: grid; + grid-template-columns: 1fr 2fr; + gap: 4em; +} + +#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2 { + border-bottom: 1px solid #c3c4c7; + padding: 1em 0 1em 5px; + margin: 0; + font-weight: normal; + color: #222; + font-family: sans-serif; + font-size: 1.3em; + letter-spacing: -0.01em; + position: relative; + transition: transform 0.3s; + cursor: pointer; } -#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 .sidebar .settings_category h2 ~ .form-table { + border-left: 1px solid #c3c4c7; + border-right: 1px solid #c3c4c7; + border-bottom: 1px solid #c3c4c7; + padding: 2em; + margin-top: -1px; + background: #ffffff; + margin-bottom: 20px; } -#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 tr, -#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state="closed"] .sidebar .form-table tr, -#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody 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="3"][data-preview-state="closed"] .sidebar .form-table tbody tr { - display: table-row; +#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2::after { + content: '\f347'; + font-family: 'dashicons'; + font-size: 16px; + color: #82878c; + position: absolute; + right: 5px; + top: 50%; + transform: translateY(-50%); + transition: transform 0.15s; } -#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table > tbody > tr > th, -#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .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="2"][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, -#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state="closed"] .sidebar .form-table > tbody > tr > td { - display: table-cell; - padding: 15px 10px 15px 0px; - width: auto; +#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2:hover:after { + color: #222; } -#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-preview-wrapper .sidebar .settings_category h2.active::after { + transform: translateY(-50%) rotate(180deg); } +#wpo-wcpdf-preview-wrapper .my_account_buttons_custom { + margin-top: 1em; +} + + /* WPML */ #wpo-wcpdf-settings .form-table .ui-tabs-nav { @@ -580,8 +594,8 @@ body.woocommerce_page_wpo_wcpdf_options_page { width: auto!important; margin: 0 auto; background: white; - box-shadow: 0 0 35px -8px rgba(0, 0, 0, 0.12); - -webkit-box-shadow: 0 0 35px -8px rgba(0, 0, 0, 0.12); + box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.1), -8px -8px 8px rgba(0, 0, 0, 0.02); + -webkit-box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.1), -8px -8px 8px rgba(0, 0, 0, 0.02); } #wpo-wcpdf-preview-wrapper[data-preview-states="2"] #preview-canvas { @@ -980,9 +994,7 @@ sup.wcpdf_beta { .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; } @@ -995,16 +1007,10 @@ sup.wcpdf_beta { width: 100%!important; } - #wpo-wcpdf-preview-wrapper .sidebar .form-table, - #wpo-wcpdf-preview-wrapper .sidebar .form-table > tr, - #wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > th, - #wpo-wcpdf-preview-wrapper .sidebar .form-table > tr > td, - #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 > th, - #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td { - display: block!important; - /*width: 100%!important;*/ + #wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table > tbody > 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="3"][data-preview-state="closed"] .sidebar .form-table > tbody > tr { + gap: 2em; } .preview-document .preview-data-wrapper { @@ -1044,6 +1050,15 @@ sup.wcpdf_beta { } } +@media screen and (max-width: 860px) { + #wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table > tbody > 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="3"][data-preview-state="closed"] .sidebar .form-table > tbody > tr { + display: block; + } +} + + /* Upgrade tab */ div.upgrade-table-description { @@ -1271,16 +1286,22 @@ div.upgrade-table-description a, } } +@media screen and (max-width: 782px) { + #wpo-wcpdf-preview-wrapper .sidebar .form-table > tbody > tr > td:has( input[type="checkbox"] + input[type="text"] ) > input { + display: inline-block; + } +} + @media screen and (max-width: 767px) { #upgrade-table td.feature-label span.description { display: none; } - + #upgrade-table th:not(.last), #upgrade-table td:not(.last) { width: 20%; } - + #upgrade-table td.first { width: 40%; } @@ -1328,3 +1349,10 @@ div.upgrade-table-description a, justify-content: center; } } + +/* Override WordPress default form style */ +@media screen and (max-width: 782px) { + input[type="radio"], input[type="checkbox"] { + margin-bottom: 0.5em; + } +} diff --git a/assets/css/settings-styles.min.css b/assets/css/settings-styles.min.css index 749e50aa0..a28f7ba40 100644 --- a/assets/css/settings-styles.min.css +++ b/assets/css/settings-styles.min.css @@ -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,.wcpdf-promo-ad{position:relative;min-height:90px;border:1px solid #6e1edc;background-color:#f1e9fc;padding:15px;padding-left:100px;margin-top:30px}img.wpo-helper{position:absolute;bottom:0;left:3px}.wcpdf-extensions-ad h3,.wcpdf-promo-ad h3{margin:0;padding:20px;font-weight:400;font-family:serif;letter-spacing:-1px;font-size:2.25em}.wcpdf-promo-ad p{margin:0;padding:0 20px;font-size:1.15em}.wcpdf-promo-ad p.upgrade-tab{margin-top:30px;font-style:italic;font-size:1em}.wcpdf-promo-ad p.expiration{font-size:.8em;padding-top:8px}.wcpdf-extensions-ad a,.wcpdf-promo-ad a{color:#6e1edc}.wcpdf-extensions-ad a.dismiss,.wcpdf-promo-ad a.dismiss{padding:10px 20px}.wcpdf-promo-ad p strong.code{font-size:1.3em;font-family:serif;padding:.1em .4em;background:#6e1edc;color:#fff;border-radius:5px;font-weight:400}.wcpdf-extensions-ad i{padding-left:20px}.wcpdf-extensions-ad ul,.wcpdf-promo-ad ul{margin:0;margin-left:40px}.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{padding-right:1em}table.multiple-text-input td{padding:0}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{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}.wcpdf_advanced_numbers_choose_table{margin-top:20px}.wcpdf_document_settings_document_output_formats{margin-bottom:30px}.edit-next-number{opacity:.5}.edit-next-number:hover{opacity:1;cursor:pointer}.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow,.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3{border-color:#51266b;background:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3:before{color:#51266b}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:not(.wcpdf_debug_settings_sections>.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:not(.wcpdf_debug_settings_sections>.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:0 0!important;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>input[type=url],#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>input[type=url],#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],#wpo-wcpdf-preview-wrapper input[type=url][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-settings .notice-info.inline{border-left-color:#51266b}#wpo-wcpdf-settings table#document-link-access-type{margin-top:-15px}#wpo-wcpdf-settings table#document-link-access-type td.option{padding-left:0}#wpo-wcpdf-settings table#document-link-access-type td{padding-top:0;padding-bottom:6px;font-size:12px}#wpo-wcpdf-settings .system-status-table{margin-top:2em}#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-ubl{width:100%;height:100%;overflow-wrap:anywhere;background-color:#222;color:#fff;padding:2em}.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;z-index:99}.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{position:absolute;top:1.55em;right:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{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}.wcpdf_ubl_settings_sections{margin-bottom:4em}#wpo-wcpdf-preview-wrapper input#due_date_days{text-align:right}#wpo-wcpdf-preview-wrapper input#due_date_days:disabled{background-color:#eaeaea;color:#999}sup.wcpdf_beta{background-color:#51266b;color:#fff;font-size:7pt;padding:1px 2px;border-radius:2px}@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}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(2),#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(3){float:left;margin-bottom:10px}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td .woocommerce-help-tip:after{padding:.5em .8em;font-size:1.2em;line-height:inherit}}div.upgrade-table-description{padding:0 0 3em 1em}div.upgrade-table-description h1{font-family:serif;letter-spacing:-1px;font-size:3em}div.upgrade-table-description p{font-size:1.1em}#upgrade-table{width:100%;border-collapse:collapse;font-size:1.2em;margin-bottom:3em}#upgrade-table td,#upgrade-table th{padding:.8em 2em;border-bottom:1px solid #ccc;text-align:center}#upgrade-table th{font-weight:400;font-size:1.1em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:200px}#upgrade-table tr:last-child td{border:none}#upgrade-table td.feature-label{text-align:left;padding-left:1em;font-weight:700;width:500px}#upgrade-table td.feature-label span.description{display:inline-block;padding-top:10px;font-size:.8em;line-height:1.4em;font-weight:400;color:#555}#upgrade-table td span.feature-available{display:inline-block;width:24px;height:24px;background-repeat:no-repeat;background-size:cover}#upgrade-table a,div.upgrade-table-description a{color:#6e1edc;white-space:nowrap}#upgrade-table .upgrade-links h4{margin:1em 0 .5em 0}#upgrade-table .upgrade-links p{margin:0;font-style:oblique;font-size:.8em}#plugin-recommendations a.upgrade_button,#upgrade-table .upgrade-links a.upgrade_button{display:inline-block;background:#fff;padding:1em 3em 1em 2em;border-radius:12px;border:1px solid #6e1edc;text-decoration:none;margin:2em 0;position:relative}#plugin-recommendations a.upgrade_button:after,#upgrade-table .upgrade-links a.upgrade_button:after{content:' \2192';display:block;position:absolute;right:1.8em;top:1.1em;transition:.5s}#plugin-recommendations a.upgrade_button:hover:after,#upgrade-table .upgrade-links a.upgrade_button:hover:after{right:1.1em;font-weight:700}#plugin-recommendations a.upgrade_button:focus,#plugin-recommendations a.upgrade_button:hover,#upgrade-table .upgrade-links a.upgrade_button:focus,#upgrade-table .upgrade-links a.upgrade_button:hover{background:#6e1edc;color:#fcfbf7}#plugin-recommendations{border-radius:8px;background-color:#f1e9fc;padding:4em 3em}#plugin-recommendations .card-container{max-width:1100px;display:grid;grid-template-columns:repeat(3,1fr);grid-gap:3em;padding:2em 0}#plugin-recommendations .recommendation-card{margin-top:0;border-radius:6px;background-color:#fff;box-shadow:0 0 25px -10px rgba(0,0,0,.2);box-sizing:border-box;font-size:15px;overflow:hidden;transition:.2s}#plugin-recommendations .recommendation-card:nth-child(n+4){display:none}#plugin-recommendations .recommendation-card:hover{scale:1.02}#plugin-recommendations .recommendation-card.currently-installed{opacity:.5}#plugin-recommendations .recommendation-card .card-content{padding:0 4em 3em 2em}#plugin-recommendations .recommendation-card img{width:100%}#plugin-recommendations .recommendation-card h5{text-align:left;font-size:1.4em;line-height:1.3em;font-weight:700;margin:1em 0}#plugin-recommendations .recommendation-card p{text-align:left;padding-bottom:10px}#plugin-recommendations .recommendation-card a.upgrade_button{margin:0}#plugin-recommendations .recommendation-card span.currently-installed{font-size:.7em;color:#fff;background-color:#6e1edc;padding:1em 2em;border-radius:12px;margin:0;display:inline-block}@media screen and (max-width:1100px){#upgrade-table{font-size:1em;line-height:1.2em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:25%;padding:.8em 1em}#upgrade-table td.last,#upgrade-table th.last{width:0;padding:0}#upgrade-table td.feature-label span.description{padding-top:6px}#plugin-recommendations .card-container{grid-gap:2em}}@media screen and (max-width:968px){#plugin-recommendations .card-container{grid-template-columns:repeat(1,1fr);padding-right:40%}}@media screen and (max-width:767px){#upgrade-table td.feature-label span.description{display:none}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:20%}#upgrade-table td.first{width:40%}#plugin-recommendations .card-container{padding-right:0}}@media screen and (max-width:649px){div.upgrade-table-description{padding-left:.8em}div.upgrade-table-description p{font-size:1em}#upgrade-table{font-size:.8em}#upgrade-table td,#upgrade-table th{padding:.5em .8em!important}#upgrade-table td span.feature-available{width:18px;height:18px}#upgrade-table .upgrade-links a{white-space:normal;padding:.6em .8em;border-radius:6px}#upgrade-table .upgrade-links a:after{display:none}#plugin-recommendations .card-container{justify-content:center}} \ No newline at end of file +span.wpo-warning{display:inline-block;border:1px solid red;border-left:4px solid red;padding:5px 15px;background-color:#fff}.wcpdf-extensions-ad,.wcpdf-promo-ad{position:relative;min-height:90px;border:1px solid #6e1edc;background-color:#f1e9fc;padding:15px;padding-left:100px;margin-top:30px}img.wpo-helper{position:absolute;bottom:0;left:3px}.wcpdf-extensions-ad h3,.wcpdf-promo-ad h3{margin:0;padding:20px;font-weight:400;font-family:serif;letter-spacing:-1px;font-size:2.25em}.wcpdf-promo-ad p{margin:0;padding:0 20px;font-size:1.15em}.wcpdf-promo-ad p.upgrade-tab{margin-top:30px;font-style:italic;font-size:1em}.wcpdf-promo-ad p.expiration{font-size:.8em;padding-top:8px}.wcpdf-extensions-ad a,.wcpdf-promo-ad a{color:#6e1edc}.wcpdf-extensions-ad a.dismiss,.wcpdf-promo-ad a.dismiss{padding:10px 20px}.wcpdf-promo-ad p strong.code{font-size:1.3em;font-family:serif;padding:.1em .4em;background:#6e1edc;color:#fff;border-radius:5px;font-weight:400}.wcpdf-extensions-ad i{padding-left:20px}.wcpdf-extensions-ad ul,.wcpdf-promo-ad ul{margin:0;margin-left:40px}.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{padding-right:1em}table.multiple-text-input td{padding:0}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{position:relative}.wcpdf_document_settings_sections>h2{cursor:pointer;padding:1em .8em;margin:0;border:1px solid #c3c4c7;background:#fff}.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 #c3c4c7;border-right:1px solid #c3c4c7;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:last-child{border-color:#c3c4c7}.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}.wcpdf_advanced_numbers_choose_table{margin-top:20px}.wcpdf_document_settings_document_output_formats{margin-bottom:30px}.edit-next-number{opacity:.5}.edit-next-number:hover{opacity:1;cursor:pointer}.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow,.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3{border-color:#51266b;background:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3:before{color:#51266b}body.woocommerce_page_wpo_wcpdf_options_page{background:#fdfdfd}.wrap [class$=icon32]+h2{font-size:18px;padding:1em}.wrap .notice{margin:15px 0 0}.nav-tab-wrapper:not(.wcpdf_debug_settings_sections>.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:not(.wcpdf_debug_settings_sections>.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:0 0!important;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{display:block;width:100%;padding:0}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th{padding-bottom:.6em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr:not(:last-child)>td{padding-bottom:2.4em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>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>input[type=url],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>textarea{max-width:none;width:100%}#wpo-wcpdf-preview-wrapper input[type=text][size],#wpo-wcpdf-preview-wrapper input[type=url][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>tbody>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="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr{display:grid;grid-template-columns:1fr 2fr;gap:4em}#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2{border-bottom:1px solid #c3c4c7;padding:1em 0 1em 5px;margin:0;font-weight:400;color:#222;font-family:sans-serif;font-size:1.3em;letter-spacing:-.01em;position:relative;transition:transform .3s;cursor:pointer}#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2~.form-table{border-left:1px solid #c3c4c7;border-right:1px solid #c3c4c7;border-bottom:1px solid #c3c4c7;padding:2em;margin-top:-1px;background:#fff;margin-bottom:20px}#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2::after{content:'\f347';font-family:dashicons;font-size:16px;color:#82878c;position:absolute;right:5px;top:50%;transform:translateY(-50%);transition:transform .15s}#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2:hover:after{color:#222}#wpo-wcpdf-preview-wrapper .sidebar .settings_category h2.active::after{transform:translateY(-50%) rotate(180deg)}#wpo-wcpdf-preview-wrapper .my_account_buttons_custom{margin-top:1em}#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-settings .notice-info.inline{border-left-color:#51266b}#wpo-wcpdf-settings table#document-link-access-type{margin-top:-15px}#wpo-wcpdf-settings table#document-link-access-type td.option{padding-left:0}#wpo-wcpdf-settings table#document-link-access-type td{padding-top:0;padding-bottom:6px;font-size:12px}#wpo-wcpdf-settings .system-status-table{margin-top:2em}#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-ubl{width:100%;height:100%;overflow-wrap:anywhere;background-color:#222;color:#fff;padding:2em}.preview-document .preview>#preview-canvas{display:block;max-width:800px;max-height:85vh;width:auto!important;margin:0 auto;background:#fff;box-shadow:8px 8px 8px rgba(0,0,0,.1),-8px -8px 8px rgba(0,0,0,.02);-webkit-box-shadow:8px 8px 8px rgba(0,0,0,.1),-8px -8px 8px rgba(0,0,0,.02)}#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;z-index:99}.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{position:absolute;top:1.55em;right:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{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}.wcpdf_ubl_settings_sections{margin-bottom:4em}#wpo-wcpdf-preview-wrapper input#due_date_days{text-align:right}#wpo-wcpdf-preview-wrapper input#due_date_days:disabled{background-color:#eaeaea;color:#999}sup.wcpdf_beta{background-color:#51266b;color:#fff;font-size:7pt;padding:1px 2px;border-radius:2px}@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}.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[data-preview-states="1"] .sidebar .form-table>tbody>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="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr{gap:2em}.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}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(2),#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(3){float:left;margin-bottom:10px}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td .woocommerce-help-tip:after{padding:.5em .8em;font-size:1.2em;line-height:inherit}}@media screen and (max-width:860px){#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>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="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr{display:block}}div.upgrade-table-description{padding:0 0 3em 1em}div.upgrade-table-description h1{font-family:serif;letter-spacing:-1px;font-size:3em}div.upgrade-table-description p{font-size:1.1em}#upgrade-table{width:100%;border-collapse:collapse;font-size:1.2em;margin-bottom:3em}#upgrade-table td,#upgrade-table th{padding:.8em 2em;border-bottom:1px solid #ccc;text-align:center}#upgrade-table th{font-weight:400;font-size:1.1em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:200px}#upgrade-table tr:last-child td{border:none}#upgrade-table td.feature-label{text-align:left;padding-left:1em;font-weight:700;width:500px}#upgrade-table td.feature-label span.description{display:inline-block;padding-top:10px;font-size:.8em;line-height:1.4em;font-weight:400;color:#555}#upgrade-table td span.feature-available{display:inline-block;width:24px;height:24px;background-repeat:no-repeat;background-size:cover}#upgrade-table a,div.upgrade-table-description a{color:#6e1edc;white-space:nowrap}#upgrade-table .upgrade-links h4{margin:1em 0 .5em 0}#upgrade-table .upgrade-links p{margin:0;font-style:oblique;font-size:.8em}#plugin-recommendations a.upgrade_button,#upgrade-table .upgrade-links a.upgrade_button{display:inline-block;background:#fff;padding:1em 3em 1em 2em;border-radius:12px;border:1px solid #6e1edc;text-decoration:none;margin:2em 0;position:relative}#plugin-recommendations a.upgrade_button:after,#upgrade-table .upgrade-links a.upgrade_button:after{content:' \2192';display:block;position:absolute;right:1.8em;top:1.1em;transition:.5s}#plugin-recommendations a.upgrade_button:hover:after,#upgrade-table .upgrade-links a.upgrade_button:hover:after{right:1.1em;font-weight:700}#plugin-recommendations a.upgrade_button:focus,#plugin-recommendations a.upgrade_button:hover,#upgrade-table .upgrade-links a.upgrade_button:focus,#upgrade-table .upgrade-links a.upgrade_button:hover{background:#6e1edc;color:#fcfbf7}#plugin-recommendations{border-radius:8px;background-color:#f1e9fc;padding:4em 3em}#plugin-recommendations .card-container{max-width:1100px;display:grid;grid-template-columns:repeat(3,1fr);grid-gap:3em;padding:2em 0}#plugin-recommendations .recommendation-card{margin-top:0;border-radius:6px;background-color:#fff;box-shadow:0 0 25px -10px rgba(0,0,0,.2);box-sizing:border-box;font-size:15px;overflow:hidden;transition:.2s}#plugin-recommendations .recommendation-card:nth-child(n+4){display:none}#plugin-recommendations .recommendation-card:hover{scale:1.02}#plugin-recommendations .recommendation-card.currently-installed{opacity:.5}#plugin-recommendations .recommendation-card .card-content{padding:0 4em 3em 2em}#plugin-recommendations .recommendation-card img{width:100%}#plugin-recommendations .recommendation-card h5{text-align:left;font-size:1.4em;line-height:1.3em;font-weight:700;margin:1em 0}#plugin-recommendations .recommendation-card p{text-align:left;padding-bottom:10px}#plugin-recommendations .recommendation-card a.upgrade_button{margin:0}#plugin-recommendations .recommendation-card span.currently-installed{font-size:.7em;color:#fff;background-color:#6e1edc;padding:1em 2em;border-radius:12px;margin:0;display:inline-block}@media screen and (max-width:1100px){#upgrade-table{font-size:1em;line-height:1.2em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:25%;padding:.8em 1em}#upgrade-table td.last,#upgrade-table th.last{width:0;padding:0}#upgrade-table td.feature-label span.description{padding-top:6px}#plugin-recommendations .card-container{grid-gap:2em}}@media screen and (max-width:968px){#plugin-recommendations .card-container{grid-template-columns:repeat(1,1fr);padding-right:40%}}@media screen and (max-width:782px){#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td:has(input[type=checkbox]+input[type=text])>input{display:inline-block}}@media screen and (max-width:767px){#upgrade-table td.feature-label span.description{display:none}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:20%}#upgrade-table td.first{width:40%}#plugin-recommendations .card-container{padding-right:0}}@media screen and (max-width:649px){div.upgrade-table-description{padding-left:.8em}div.upgrade-table-description p{font-size:1em}#upgrade-table{font-size:.8em}#upgrade-table td,#upgrade-table th{padding:.5em .8em!important}#upgrade-table td span.feature-available{width:18px;height:18px}#upgrade-table .upgrade-links a{white-space:normal;padding:.6em .8em;border-radius:6px}#upgrade-table .upgrade-links a:after{display:none}#plugin-recommendations .card-container{justify-content:center}}@media screen and (max-width:782px){input[type=checkbox],input[type=radio]{margin-bottom:.5em}} \ No newline at end of file diff --git a/assets/js/admin-script.js b/assets/js/admin-script.js index 6b518a481..29ab0b02f 100644 --- a/assets/js/admin-script.js +++ b/assets/js/admin-script.js @@ -49,10 +49,10 @@ jQuery( function( $ ) { $( "[name='wpo_wcpdf_documents_settings_invoice[display_number]']" ).on( 'change', function( event ) { if ( $( this ).val() == 'order_number' ) { $( this ).closest( 'td' ).find( '.description' ).slideDown(); - $( this ).closest( 'tr' ).next( 'tr' ).hide(); + $( this ).closest( 'tr' ).nextAll( 'tr' ).has( 'input#next_invoice_number' ).first().hide(); } else { $( this ).closest( 'td' ).find( '.description' ).hide(); - $( this ).closest( 'tr' ).next( 'tr' ).show(); + $( this ).closest( 'tr' ).nextAll( 'tr' ).has( 'input#next_invoice_number' ).first().show(); } } ).trigger( 'change' ); @@ -596,4 +596,30 @@ jQuery( function( $ ) { //----------> /Preview <----------// + function settingsAccordion() { + // Default to expanded for '#general', collapsed for others. + $( '.settings_category' ).not( '#general' ).find( '.form-table' ).hide(); + $( '#general > h2' ).addClass( 'active' ); + + // Retrieve the state from localStorage + $( '.settings_category h2' ).each( function( index ) { + const state = localStorage.getItem( 'wcpdf_accordion_state_' + index ); + if ( 'true' === state ) { + $( this ).addClass( 'active' ).next( '.form-table' ).show(); + } + } ); + + $('.settings_category h2' ).on( 'click', function() { + const index = $( '.settings_category h2' ).index( this ); + + $( this ).toggleClass( 'active' ).next( '.form-table' ).slideToggle( 'fast', function() { + // Save the state in localStorage + const isVisible = $( this ).is( ':visible' ); + localStorage.setItem( 'wcpdf_accordion_state_' + index, isVisible ); + } ); + } ); + } + + settingsAccordion(); + } ); diff --git a/assets/js/admin-script.min.js b/assets/js/admin-script.min.js index 4887d2b0c..3b7f2d1de 100644 --- a/assets/js/admin-script.min.js +++ b/assets/js/admin-script.min.js @@ -1 +1 @@ -jQuery(function(a){function b(){m=w.val(),n=x.val(),o=y.val(),p=z.val(),q=A.serialize()}function c(){w.val("").trigger("change")}function d(){!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",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 e(a){window.scrollTo(0,0);let b=a;setTimeout(function(){b.addClass("static")},300)}function f(b,c){g();let d=a(b.target);if(!i(d.attr("name"))){if(d.hasClass("remove-requirement")||"disable_for"==d.attr("id"))return;if(-1!==jQuery.inArray(b.type,["keyup","paste"])){if(d.is("input[type=\"checkbox\"], select"))return;c="keyup"==b.type?1e3:0}h(c)}}function g(b){a(".preview-data-wrapper .save-settings p").css("margin-right","0")}function h(a){a="number"==typeof a?a:0,b(),clearTimeout(r),r=setTimeout(function(){j()},a)}function i(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 j(){let b=wpo_wcpdf_admin.pdfjs_worker,c="preview-canvas",d={action:"wpo_wcpdf_preview",security:p,order_id:m,document_type:n,output_format:o,data:q};v.children(".notice").remove(),v.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),B=a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:d,beforeSend:function(a,b){null!=B&&B.abort()},success:function(d,e,f){if(d.data.error)a("#"+c).remove(),v.append("

"+d.data.error+"

");else if(d.data.preview_data&&d.data.output_format)switch(a("#"+c).remove(),d.data.output_format){default:case"pdf":v.append(""),k(b,c,d.data.preview_data);break;case"ubl":let a=d.data.preview_data,e=a.replace(/&/g,"&").replace(//g,">").replace(/ /g," ").replace(/\n/g,"
");v.html("
"+e+"
")}v.unblock()},error:function(b,d,e){if("abort"!=d){let d=b.status+": "+b.statusText;a("#"+c).remove(),v.append("

"+d+"

"),v.unblock()}}})}function k(a,b,c){c=window.atob(c),pdfjsLib.GlobalWorkerOptions.workerSrc=a;let d=pdfjsLib.getDocument({data:c});d.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 l(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:n};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(""+d.data.error+""),c.show()):a.each(d.data,function(a,b){let d="#"+b.order_number+" - "+b.billing_first_name+" "+b.billing_last_name;0"+b.date_created+""+b.total+"";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=$input.val();if(0 h2").on("click",function(){a(this).parent().find("ul").toggleClass("active")}),a.each(wpo_wcpdf_admin.pointers,function(b,c){a(c.target).pointer({content:c.content,position:{edge:c.position.edge,align:c.position.align},pointerClass:c.pointer_class,pointerWidth:c.pointer_width,close:function(){jQuery.post(wpo_wcpdf_admin.ajaxurl,{pointer:b,action:"dismiss-wp-pointer"})}}),-1===a.inArray(b,wpo_wcpdf_admin.dismissed_pointers.split(","))&&a(c.target).pointer("open")}),a(".woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("#wpo-wcpdf-preview-wrapper #due_date").on("change",function(){const b=a("#wpo-wcpdf-preview-wrapper #due_date"),c=a("#wpo-wcpdf-preview-wrapper #due_date_days");b.is(":checked")?c.prop("disabled",!1):c.prop("disabled",!0)}).trigger("change");let m,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=\"output_format\"]"),z=a("#wpo-wcpdf-preview-wrapper input[name=\"nonce\"]"),A=a("#wpo-wcpdf-settings"),B=null;(function a(){x.val(x.data("default")).trigger("change")})(),c(),b(),t=a(window).width(),d(),a(window).on("resize",d),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"),e(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"),e(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(),c(),h())}),h(),a(document).on("wpo-wcpdf-settings-changed",function(a,b){g(),h(b)}),a(document).on("wpo-wcpdf-refresh-preview wpo_wcpdf_refresh_preview",function(a,b){h(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")).trigger("change"),a(this).closest("div").hide(),a(this).closest("div").children("a").remove(),h()}),a(document).on("keyup paste","#wpo-wcpdf-settings input, #wpo-wcpdf-settings textarea",f),a(document).on("change","#wpo-wcpdf-settings input[type=\"checkbox\"], #wpo-wcpdf-settings input[type=\"radio\"], #wpo-wcpdf-settings select",function(a){a.isTrigger||f(a)}),a(document).on("select2:select select2:unselect","#wpo-wcpdf-settings select.wc-enhanced-select",f),a(document.body).on("wpo-wcpdf-media-upload-setting-updated",f),a(document).on("click",".wpo_remove_image_button, #wpo-wcpdf-settings .remove-requirement",f),a(document.body).on("click",".preview-data-wrapper .save-settings p input",function(b){a("#wpo-wcpdf-settings input#submit").trigger("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()),h()}}).trigger("change"),w.on("change",function(){h()}).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(){l(d)},e)})}); \ No newline at end of file +jQuery(function(a){function b(){m=w.val(),n=x.val(),o=y.val(),p=z.val(),q=A.serialize()}function c(){w.val("").trigger("change")}function d(){!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",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 e(a){window.scrollTo(0,0);let b=a;setTimeout(function(){b.addClass("static")},300)}function f(b,c){g();let d=a(b.target);if(!i(d.attr("name"))){if(d.hasClass("remove-requirement")||"disable_for"==d.attr("id"))return;if(-1!==jQuery.inArray(b.type,["keyup","paste"])){if(d.is("input[type=\"checkbox\"], select"))return;c="keyup"==b.type?1e3:0}h(c)}}function g(b){a(".preview-data-wrapper .save-settings p").css("margin-right","0")}function h(a){a="number"==typeof a?a:0,b(),clearTimeout(r),r=setTimeout(function(){j()},a)}function i(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 j(){let b=wpo_wcpdf_admin.pdfjs_worker,c="preview-canvas",d={action:"wpo_wcpdf_preview",security:p,order_id:m,document_type:n,output_format:o,data:q};v.children(".notice").remove(),v.block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),B=a.ajax({type:"POST",url:wpo_wcpdf_admin.ajaxurl,data:d,beforeSend:function(a,b){null!=B&&B.abort()},success:function(d,e,f){if(d.data.error)a("#"+c).remove(),v.append("

"+d.data.error+"

");else if(d.data.preview_data&&d.data.output_format)switch(a("#"+c).remove(),d.data.output_format){default:case"pdf":v.append(""),k(b,c,d.data.preview_data);break;case"ubl":let a=d.data.preview_data,e=a.replace(/&/g,"&").replace(//g,">").replace(/ /g," ").replace(/\n/g,"
");v.html("
"+e+"
")}v.unblock()},error:function(b,d,e){if("abort"!=d){let d=b.status+": "+b.statusText;a("#"+c).remove(),v.append("

"+d+"

"),v.unblock()}}})}function k(a,b,c){c=window.atob(c),pdfjsLib.GlobalWorkerOptions.workerSrc=a;let d=pdfjsLib.getDocument({data:c});d.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 l(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:n};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(""+d.data.error+""),c.show()):a.each(d.data,function(a,b){let d="#"+b.order_number+" - "+b.billing_first_name+" "+b.billing_last_name;0"+b.date_created+""+b.total+"";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=$input.val();if(0 h2").on("click",function(){a(this).parent().find("ul").toggleClass("active")}),a.each(wpo_wcpdf_admin.pointers,function(b,c){a(c.target).pointer({content:c.content,position:{edge:c.position.edge,align:c.position.align},pointerClass:c.pointer_class,pointerWidth:c.pointer_width,close:function(){jQuery.post(wpo_wcpdf_admin.ajaxurl,{pointer:b,action:"dismiss-wp-pointer"})}}),-1===a.inArray(b,wpo_wcpdf_admin.dismissed_pointers.split(","))&&a(c.target).pointer("open")}),a(".woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("#wpo-wcpdf-preview-wrapper #due_date").on("change",function(){const b=a("#wpo-wcpdf-preview-wrapper #due_date"),c=a("#wpo-wcpdf-preview-wrapper #due_date_days");b.is(":checked")?c.prop("disabled",!1):c.prop("disabled",!0)}).trigger("change");let m,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=\"output_format\"]"),z=a("#wpo-wcpdf-preview-wrapper input[name=\"nonce\"]"),A=a("#wpo-wcpdf-settings"),B=null;(function a(){x.val(x.data("default")).trigger("change")})(),c(),b(),t=a(window).width(),d(),a(window).on("resize",d),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"),e(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"),e(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(),c(),h())}),h(),a(document).on("wpo-wcpdf-settings-changed",function(a,b){g(),h(b)}),a(document).on("wpo-wcpdf-refresh-preview wpo_wcpdf_refresh_preview",function(a,b){h(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")).trigger("change"),a(this).closest("div").hide(),a(this).closest("div").children("a").remove(),h()}),a(document).on("keyup paste","#wpo-wcpdf-settings input, #wpo-wcpdf-settings textarea",f),a(document).on("change","#wpo-wcpdf-settings input[type=\"checkbox\"], #wpo-wcpdf-settings input[type=\"radio\"], #wpo-wcpdf-settings select",function(a){a.isTrigger||f(a)}),a(document).on("select2:select select2:unselect","#wpo-wcpdf-settings select.wc-enhanced-select",f),a(document.body).on("wpo-wcpdf-media-upload-setting-updated",f),a(document).on("click",".wpo_remove_image_button, #wpo-wcpdf-settings .remove-requirement",f),a(document.body).on("click",".preview-data-wrapper .save-settings p input",function(b){a("#wpo-wcpdf-settings input#submit").trigger("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()),h()}}).trigger("change"),w.on("change",function(){h()}).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(){l(d)},e)}),function b(){a(".settings_category").not("#general").find(".form-table").hide(),a("#general > h2").addClass("active"),a(".settings_category h2").each(function(b){const c=localStorage.getItem("wcpdf_accordion_state_"+b);"true"===c&&a(this).addClass("active").next(".form-table").show()}),a(".settings_category h2").on("click",function(){const b=a(".settings_category h2").index(this);a(this).toggleClass("active").next(".form-table").slideToggle("fast",function(){const c=a(this).is(":visible");localStorage.setItem("wcpdf_accordion_state_"+b,c)})})}()}); \ No newline at end of file diff --git a/includes/Documents/Invoice.php b/includes/Documents/Invoice.php index 1c8734311..6f5726b12 100644 --- a/includes/Documents/Invoice.php +++ b/includes/Documents/Invoice.php @@ -619,6 +619,78 @@ public function get_ubl_settings_fields( $option_name ) { return apply_filters( "wpo_wcpdf_{$this->type}_ubl_settings_fields", $settings_fields, $option_name, $this ); } + /** + * Get the settings categories. + * + * @param string $output_format + * + * @return array + */ + public function get_settings_categories( string $output_format ): array { + if ( ! in_array( $output_format, $this->output_formats, true ) ) { + return array(); + } + + $settings_categories = array( + 'pdf' => array( + 'general' => array( + 'title' => __( 'General', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'enabled', + 'attach_to_email_ids', + 'disable_for_statuses', + 'my_account_buttons', + ), + ), + 'document_details' => array( + 'title' => __( 'Document details', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'display_email', + 'display_phone', + 'display_customer_notes', + 'display_shipping_address', + 'display_number', + 'next_invoice_number', // this should follow 'display_number' + 'number_format', + 'display_date', + 'due_date' + ) + ), + 'admin_display' => array( + 'title' => __( 'Admin', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'invoice_number_column', + 'invoice_date_column', + 'invoice_number_search', + ), + ), + 'advanced' => array( + 'title' => __( 'Advanced', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'next_invoice_number', + 'reset_number_yearly', + 'mark_printed', + 'unmark_printed', + 'disable_free', + 'use_latest_settings', + ) + ), + ), + 'ubl' => array( + 'general' => array( + 'title' => __( 'General', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'enabled', + 'attach_to_email_ids', + 'include_encrypted_pdf', + ), + ), + ) + ); + + return apply_filters( 'wpo_wcpdf_document_settings_categories', $settings_categories[ $output_format ], $output_format, $this ); + } + } endif; // class_exists diff --git a/includes/Documents/PackingSlip.php b/includes/Documents/PackingSlip.php index 2f46ad98d..496272e9c 100644 --- a/includes/Documents/PackingSlip.php +++ b/includes/Documents/PackingSlip.php @@ -201,11 +201,50 @@ public function init_settings() { $settings_fields = WPO_WCPDF()->settings->move_setting_after_id( $settings_fields, $pro_notice, 'enabled' ); } - // allow plugins to alter settings fields + // Legacy filter to allow plugins to alter settings fields. $settings_fields = apply_filters( 'wpo_wcpdf_settings_fields_documents_packing_slip', $settings_fields, $page, $option_group, $option_name ); - WPO_WCPDF()->settings->add_settings_fields( $settings_fields, $page, $option_group, $option_name ); - return; + // Allow plugins to alter settings fields. + if ( ! empty( $settings_fields ) ) { + $settings_fields = apply_filters( "wpo_wcpdf_settings_fields_documents_{$this->type}_pdf", $settings_fields, $page, $option_group, $option_name, $this ); + WPO_WCPDF()->settings->add_settings_fields( $settings_fields, $page, $option_group, $option_name ); + } + } + + /** + * Get the settings categories. + * + * @param string $output_format + * + * @return array + */ + public function get_settings_categories( string $output_format ): array { + if ( ! in_array( $output_format, $this->output_formats, true ) ) { + return array(); + } + + $settings_categories = array( + 'pdf' => array( + 'general' => array( + 'title' => __( 'General', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'enabled', + 'attach_to_email_ids', + ), + ), + 'document_details' => array( + 'title' => __( 'Document details', 'woocommerce-pdf-invoices-packing-slips' ), + 'members' => array( + 'display_email', + 'display_phone', + 'display_customer_notes', + 'display_billing_address', + ), + ), + ), + ); + + return apply_filters( 'wpo_wcpdf_document_settings_categories', $settings_categories[ $output_format ], $output_format, $this ); } } diff --git a/includes/Settings.php b/includes/Settings.php index 108903ee1..887c0f7eb 100644 --- a/includes/Settings.php +++ b/includes/Settings.php @@ -86,6 +86,9 @@ public function __construct() { // schedule yearly reset numbers add_action( 'wpo_wcpdf_schedule_yearly_reset_numbers', array( $this, 'yearly_reset_numbers' ) ); + + // Apply settings sections. + add_action( 'wpo_wcpdf_init_documents', array( $this, 'update_documents_settings_sections' ), 999 ); } public function menu() { @@ -179,7 +182,7 @@ public function settings_page() { 'preview_states' => 3, ), ) ); - + if ( wcpdf_is_ubl_available() ) { $settings_tabs['ubl'] = array( 'title' => __( 'UBL', 'woocommerce-pdf-invoices-packing-slips' ), @@ -479,7 +482,8 @@ public function add_settings_fields( $settings_fields, $page, $option_group, $op $settings_field['id'], $settings_field['title'], $callback, - $page + $page, + $settings_field['args'] ?? array() ); } else { add_settings_field( @@ -1008,6 +1012,227 @@ public function move_setting_after_id( $settings, $insert_settings, $after_setti return $new_settings; } + /** + * Applies categories to document settings. + * + * @return void + */ + public function update_documents_settings_sections(): void { + $documents = WPO_WCPDF()->documents->get_documents(); + + foreach ( $documents as $document ) { + foreach ( $document->output_formats as $output_format ) { + add_filter( "wpo_wcpdf_settings_fields_documents_{$document->get_type()}_{$output_format}", array( $this, 'apply_settings_categories' ), 999 ); + } + } + } + + /** + * Apply settings categories to the settings fields. + * + * @param array $settings_fields + * + * @return array + */ + public function apply_settings_categories( array $settings_fields ): array { + $current_filter = explode( '_', current_filter() ); + $output_format = end( $current_filter ); + $document_type = prev( $current_filter ); + $document = wcpdf_get_document( $document_type, null ); + + if ( ! $document ) { + return $settings_fields; + } + + $settings_categories = is_callable( array( $document, 'get_settings_categories' ) ) ? $document->get_settings_categories( $output_format ) : array(); + + // Return if no category found! + if ( empty( $settings_categories ) ) { + return $settings_fields; + } + + // Remove all sections first. + foreach ( $settings_fields as $key => $field ) { + if ( 'section' === $field['type'] ) { + unset( $settings_fields[ $key ] ); + } + } + + $modified_settings_fields = array(); + $settings_lookup = array(); + $processed_keys = array(); + + // Create a lookup array for settings fields by id. + // This allows for quick access to settings fields by their id, reducing the time complexity + // of finding a settings field from O(n*m) to O(n+m), where n is the number of category members + // and m is the number of settings fields. + foreach ( $settings_fields as $key => $settings_field ) { + $settings_lookup[ $settings_field['id'] ] = $key; + } + + // Update settings fields. + foreach ( $settings_categories as $category_name => $category_details ) { + // Add section for each category. + $modified_settings_fields[] = $this->create_section( $category_name, $category_details['title'] ); + + // Add settings fields based on the order in the members array. + foreach ( $category_details['members'] as $member ) { + if ( isset( $settings_lookup[ $member ] ) ) { + $key = $settings_lookup[ $member ]; + + // Skip if the key has already been processed. + if ( in_array( $key, $processed_keys, true ) ) { + continue; + } + + $settings_field = $settings_fields[ $key ]; + $settings_field['section'] = $category_name; + $modified_settings_fields[] = $settings_field; + $processed_keys[] = $key; + } + } + } + + // Check for any unprocessed settings fields. + $unprocessed_settings_fields = array_diff_key( $settings_fields, array_flip( $processed_keys ) ); + + // Create an "Additional settings" section for uncategorized settings fields. + if ( ! empty( $unprocessed_settings_fields ) ) { + $category_name = 'additional'; + + $modified_settings_fields[] = $this->create_section( + $category_name, + __( 'Additional settings', 'woocommerce-pdf-invoices-packing-slips' ) + ); + + // Add rest of settings to the $modified_settings_fields array under "More" category + foreach ( $unprocessed_settings_fields as $settings_field ) { + $settings_field['section'] = $category_name; + $modified_settings_fields[] = $settings_field; + } + } + + return $modified_settings_fields; + } + + /** + * Creates a section array for settings fields. + * + * @param string $category_name The ID of the category. + * @param string $category_title The title of the section. + * + * @return array The section configuration array. + */ + private function create_section( string $category_name, string $category_title ): array { + return array( + 'type' => 'section', + 'id' => $category_name, + 'title' => $category_title, + 'callback' => 'section', + 'args' => array( + 'before_section' => '
', + 'after_section' => '
', + ), + ); + } + + /** + * Helper method to add a single setting field to a category. + * + * @param array $settings_categories Array of existing settings categories, with category names as keys. + * @param string $new_setting_id The new setting ID to add to the specified category. + * @param string $category_name Name of the category to which the settings will be added. + * @param int|null $position Optional. The position at which to insert the new settings (starts from 1). Defaults to appending at the end. + * + * @return array + */ + public function add_single_setting_field_to_category( array $settings_categories, string $new_setting_id, string $category_name, ?int $position = null ): array { + return $this->add_setting_field_to_category( $settings_categories, array( $new_setting_id ), $category_name, $position ); + } + + /** + * Helper method to add multiple setting fields to a category. + * + * @param array $settings_categories Array of existing settings categories, with category names as keys. + * @param array $new_setting_ids Array of new setting IDs to add to the specified category. + * @param string $category_name Name of the category to which the settings will be added. + * @param int|null $position Optional. The position at which to insert the new settings (starts from 1). Defaults to appending at the end. + * + * @return array + */ + public function add_multiple_setting_fields_to_category( array $settings_categories, array $new_setting_ids, string $category_name, ?int $position = null ): array { + return $this->add_setting_field_to_category( $settings_categories, $new_setting_ids, $category_name, $position ); + } + + /** + * Internal method to handle adding setting fields to a category. + * + * @param array $settings_categories Array of existing settings categories, with category names as keys. + * @param array $new_setting_ids Array of new setting IDs to add to the specified category. + * @param string $category_name Name of the category to which the settings will be added. + * @param int|null $position Optional. The position at which to insert the new settings (1-based index). Defaults to appending at the end. + * + * @return array + */ + private function add_setting_field_to_category( array $settings_categories, array $new_setting_ids, string $category_name, ?int $position = null ): array { + if ( ! isset( $settings_categories[ $category_name ] ) ) { + return $settings_categories; + } + + $members = &$settings_categories[ $category_name ]['members']; + + if ( is_null( $position ) || 0 === $position ) { + $members = array_merge( $members, $new_setting_ids ); + } else { + array_splice( $members, $position - 1, 0, $new_setting_ids ); + } + + return $settings_categories; + } + + /** + * Get the position of a specific setting in the settings array. + * + * @param array $settings_categories Array of settings categories where the setting name is searched. + * @param string $category Name of the category to search in. + * @param string $setting_name Name of the setting to find in the settings array. + * + * @return int Position of the setting (1-based index) if found; otherwise, returns 0. + */ + public function get_setting_position( array $settings_categories, string $category, string $setting_name ): int { + if ( empty( $settings_categories[ $category ]['members'] ) ) { + return 0; + } + + $key = array_search( $setting_name, $settings_categories[ $category ]['members'], true ); + + return $key !== false ? absint( $key ) + 1: 0; + } + + /** + * Helper method to add a setting category. + * + * @param array $settings_categories + * @param string $category_name + * @param string $title + * @param array $members + * + * @return array + */ + public function add_settings_category( array $settings_categories, string $category_name, string $title, array $members ): array { + // Do not override if the category already exist. + if ( isset( $settings_categories[ $category_name ] ) ) { + return $settings_categories; + } + + $settings_categories[ $category_name ] = array( + 'title' => $title, + 'members' => $members, + ); + + return $settings_categories; + } + } endif; // class_exists diff --git a/woocommerce-pdf-invoices-packingslips.php b/woocommerce-pdf-invoices-packingslips.php index 089b170a5..dc4b1f434 100644 --- a/woocommerce-pdf-invoices-packingslips.php +++ b/woocommerce-pdf-invoices-packingslips.php @@ -4,7 +4,7 @@ * Requires Plugins: woocommerce * Plugin URI: https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/ * Description: Create, print & email PDF or UBL Invoices & PDF Packing Slips for WooCommerce orders. - * Version: 3.9.0 + * Version: 3.9.1-beta-1 * Author: WP Overnight * Author URI: https://www.wpovernight.com * License: GPLv2 or later @@ -22,7 +22,7 @@ class WPO_WCPDF { - public $version = '3.9.0'; + public $version = '3.9.1-beta-1'; public $version_php = '7.2'; public $version_woo = '3.3'; public $version_wp = '4.4'; From 1c67502a16343abafb313ceb111954ac614df847 Mon Sep 17 00:00:00 2001 From: Alexandre Faustino Date: Mon, 4 Nov 2024 14:35:46 +0000 Subject: [PATCH 2/5] Fix: template item meta styling (#901) --- templates/Simple/invoice.php | 6 +++--- templates/Simple/packing-slip.php | 6 +++--- templates/Simple/style.css | 18 +++++++----------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/templates/Simple/invoice.php b/templates/Simple/invoice.php index 297342298..0c9d5b569 100644 --- a/templates/Simple/invoice.php +++ b/templates/Simple/invoice.php @@ -118,18 +118,18 @@

get_type(), $item, $this->order ); ?> -
+

sku_title(); ?>

weight_title(); ?>

- + - +
get_type(), $item, $this->order ); ?> diff --git a/templates/Simple/packing-slip.php b/templates/Simple/packing-slip.php index 274a7158f..23ca2fe14 100644 --- a/templates/Simple/packing-slip.php +++ b/templates/Simple/packing-slip.php @@ -100,18 +100,18 @@

get_type(), $item, $this->order ); ?> -
+

sku_title(); ?>

weight_title(); ?>

- + - +
get_type(), $item, $this->order ); ?> diff --git a/templates/Simple/style.css b/templates/Simple/style.css index 3dccca56b..611bf6722 100644 --- a/templates/Simple/style.css +++ b/templates/Simple/style.css @@ -45,7 +45,7 @@ ul { } li { - margin-bottom: 0.75em; + margin: 0; } p { @@ -224,8 +224,9 @@ table.notes-totals { } /* item meta formatting */ -.item-meta { - margin: 8px 0 0 0; +.item-meta, +.meta { + margin: 4px 0 0 0; font-size: 7pt; line-height: 7pt; overflow-wrap: anywhere; @@ -236,11 +237,6 @@ table.notes-totals { margin: 0; } -.wc-item-meta li { - margin-top: 4px; - margin-left: 0; -} - .wc-item-meta li p, .wc-item-meta li dd { display: inline; @@ -248,9 +244,9 @@ table.notes-totals { .wc-item-meta p, .wc-item-meta dd, -.item-meta p { - margin-top: 4px; - margin-left: 0; +.item-meta p, +.meta p { + margin: 0; } /* Notes & Totals */ From 0ac493b361101066a093afef70dc255c0faff578 Mon Sep 17 00:00:00 2001 From: Alexandre Faustino Date: Tue, 5 Nov 2024 14:00:46 +0000 Subject: [PATCH 3/5] New: removes space between items table and totals (#906) --- templates/Simple/style.css | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/Simple/style.css b/templates/Simple/style.css index 611bf6722..16c44ea63 100644 --- a/templates/Simple/style.css +++ b/templates/Simple/style.css @@ -173,7 +173,7 @@ td.order-data table th { table.order-details, table.notes-totals { width: 100%; - margin-bottom: 8mm; + margin-bottom: 0; page-break-before: avoid; } @@ -258,7 +258,7 @@ table.notes-totals { table.totals { width: 100%; - margin-top: 5mm; + margin-top: 0; table-layout: fixed; } @@ -269,6 +269,12 @@ table.totals td { border-bottom: 1px solid #ccc; } +table.totals tr:nth-child(1) th, +table.totals tr:nth-child(1) td { + border-top: 0; + border-bottom: 0; +} + table.totals th.description, table.totals td.price { width: 50%; From fc969dcb9369ac1a76094036d628864bdab493d2 Mon Sep 17 00:00:00 2001 From: Alexandre Faustino Date: Wed, 6 Nov 2024 10:52:35 +0000 Subject: [PATCH 4/5] v3.9.1-beta-1 --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 5a43618f9..97a8827f9 100644 --- a/readme.txt +++ b/readme.txt @@ -3,9 +3,9 @@ Contributors: pomegranate, alexmigf, yordansoares, kluver, dpeyou, dwpriv, moham Donate link: https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/ Tags: woocommerce, pdf, ubl, invoices, packing slips Requires at least: 4.4 -Tested up to: 6.6 +Tested up to: 6.7 Requires PHP: 7.2 -Stable tag: 3.9.0 +Stable tag: 3.9.1-beta-1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html From 1a48ec51d7d8328d06a34d6a3c8f38609242a4b7 Mon Sep 17 00:00:00 2001 From: Alexandre Faustino Date: Wed, 20 Nov 2024 11:11:14 +0000 Subject: [PATCH 5/5] New: raised the minimum PHP version requirement to 7.4 (#910) --- includes/Install.php | 4 +- includes/Main.php | 2 +- views/advanced-status.php | 4 +- woocommerce-pdf-invoices-packingslips.php | 78 +---------------------- wpo-ips-functions.php | 2 +- 5 files changed, 7 insertions(+), 83 deletions(-) diff --git a/includes/Install.php b/includes/Install.php index 1414e4b54..2585c625e 100644 --- a/includes/Install.php +++ b/includes/Install.php @@ -82,7 +82,7 @@ public function do_install() { */ protected function install() { // only install when php version or higher - if ( version_compare( PHP_VERSION, '7.2', '<' ) ) { + if ( ! WPO_WCPDF()->is_dependency_version_supported( 'php' ) ) { return; } @@ -212,7 +212,7 @@ protected function install() { */ protected function upgrade( $installed_version ) { // only upgrade when php version or higher - if ( version_compare( PHP_VERSION, '7.2', '<' ) ) { + if ( ! WPO_WCPDF()->is_dependency_version_supported( 'php' ) ) { return; } diff --git a/includes/Main.php b/includes/Main.php index aa8d5bf30..423c2b055 100644 --- a/includes/Main.php +++ b/includes/Main.php @@ -1247,7 +1247,7 @@ public function export_order_personal_data_meta( $meta_to_export ) { * Fixed in WP5.5 due to upgrade to newer PHPMailer */ public function set_phpmailer_validator( $mailArray ) { - if ( version_compare( PHP_VERSION, '7.3', '>=' ) && version_compare( get_bloginfo( 'version' ), '5.5-dev', '<' ) ) { + if ( version_compare( get_bloginfo( 'version' ), '5.5-dev', '<' ) ) { global $phpmailer; if ( ! ( $phpmailer instanceof \PHPMailer ) ) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; diff --git a/views/advanced-status.php b/views/advanced-status.php index 9a449fcf6..c53a62dfa 100644 --- a/views/advanced-status.php +++ b/views/advanced-status.php @@ -10,9 +10,9 @@ $server_configs = array( 'PHP version' => array( - 'required' => __( '7.2+ (7.4 or higher recommended)', 'woocommerce-pdf-invoices-packing-slips' ), + 'required' => __( '7.4 or superior', 'woocommerce-pdf-invoices-packing-slips' ), 'value' => PHP_VERSION, - 'result' => version_compare( PHP_VERSION, '7.2', '>' ), + 'result' => WPO_WCPDF()->is_dependency_version_supported( 'php' ), ), 'DOMDocument extension' => array( 'required' => true, diff --git a/woocommerce-pdf-invoices-packingslips.php b/woocommerce-pdf-invoices-packingslips.php index dc4b1f434..0af89f262 100644 --- a/woocommerce-pdf-invoices-packingslips.php +++ b/woocommerce-pdf-invoices-packingslips.php @@ -23,7 +23,7 @@ class WPO_WCPDF { public $version = '3.9.1-beta-1'; - public $version_php = '7.2'; + public $version_php = '7.4'; public $version_woo = '3.3'; public $version_wp = '4.4'; public $plugin_basename; @@ -76,8 +76,6 @@ public function __construct() { add_action( 'admin_notices', array( $this, 'nginx_detected' ) ); add_action( 'admin_notices', array( $this, 'mailpoet_mta_detected' ) ); add_action( 'admin_notices', array( $this, 'rtl_detected' ) ); - add_action( 'admin_notices', array( $this, 'php_below_7_4_drop' ) ); - add_action( 'admin_notices', array( $this, 'ubl_php_version_required' ) ); add_action( 'admin_notices', array( $this, 'legacy_addon_notices' ) ); add_action( 'init', array( '\\WPO\\IPS\\Semaphore', 'init_cleanup' ), 999 ); // wait AS to initialize @@ -455,80 +453,6 @@ public function rtl_detected() { } } - /** - * PHP below 7.4 notice - * - * @return void - */ - public function php_below_7_4_drop(): void { - if ( ! is_super_admin() ) { - return; - } - - if ( version_compare( PHP_VERSION, '7.4', '<' ) && ! get_option( 'wpo_wcpdf_hide_php_below_7_4_drop_notice' ) ) { - ob_start(); - ?> -
-

- PDF Invoices & Packing Slips for WooCommerce' - ); - ?> -

-

-
- -
-

-

-
- =' ) ); + return apply_filters( 'wpo_wcpdf_ubl_available', WPO_WCPDF()->is_dependency_version_supported( 'php' ) ); } /**