Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 857-setup-wizard-update
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoPavlinic98 committed Nov 4, 2024
2 parents 20dc68e + 0a1436d commit 16d314f
Show file tree
Hide file tree
Showing 11 changed files with 474 additions and 84 deletions.
146 changes: 87 additions & 59 deletions assets/css/settings-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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%;
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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%;
}
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion assets/css/settings-styles.min.css

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions assets/js/admin-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -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();

} );
Loading

0 comments on commit 16d314f

Please sign in to comment.