update
This commit is contained in:
@@ -275,6 +275,8 @@ var AI_OPENAI_ENABLED = <?= $openai_enabled ? 'true' : 'false'; ?>;
|
||||
var AI_CLAUDE_ENABLED = <?= $claude_enabled ? 'true' : 'false'; ?>;
|
||||
var AI_GEMINI_ENABLED = <?= $gemini_enabled ? 'true' : 'false'; ?>;
|
||||
var PRODUCTS_COLUMNS_STORAGE_KEY = 'products.columns.visibility';
|
||||
var PRODUCTS_PAGE_LENGTH_STORAGE_KEY = 'products.page.length';
|
||||
var PRODUCTS_ALLOWED_PAGE_LENGTHS = [ 10, 25, 50, 100 ];
|
||||
var PRODUCTS_LOCKED_COLUMNS = [ 0, 21 ];
|
||||
var products_bestseller_settings_loading = false;
|
||||
var products_bestseller_preview_timer = null;
|
||||
@@ -356,6 +358,30 @@ function products_storage_get( key )
|
||||
}
|
||||
}
|
||||
|
||||
function products_get_saved_page_length()
|
||||
{
|
||||
var page_length = parseInt( products_storage_get( PRODUCTS_PAGE_LENGTH_STORAGE_KEY ), 10 );
|
||||
|
||||
if ( PRODUCTS_ALLOWED_PAGE_LENGTHS.indexOf( page_length ) === -1 )
|
||||
{
|
||||
return 25;
|
||||
}
|
||||
|
||||
return page_length;
|
||||
}
|
||||
|
||||
function products_save_page_length( page_length )
|
||||
{
|
||||
page_length = parseInt( page_length, 10 );
|
||||
|
||||
if ( PRODUCTS_ALLOWED_PAGE_LENGTHS.indexOf( page_length ) === -1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
products_storage_set( PRODUCTS_PAGE_LENGTH_STORAGE_KEY, page_length );
|
||||
}
|
||||
|
||||
function products_is_locked_column( idx )
|
||||
{
|
||||
return PRODUCTS_LOCKED_COLUMNS.indexOf( Number( idx ) ) !== -1;
|
||||
@@ -714,8 +740,30 @@ $( function()
|
||||
serverSide: true,
|
||||
autoWidth: false,
|
||||
searching: false,
|
||||
lengthChange: false,
|
||||
pageLength: 25,
|
||||
lengthChange: true,
|
||||
lengthMenu: [ PRODUCTS_ALLOWED_PAGE_LENGTHS, PRODUCTS_ALLOWED_PAGE_LENGTHS ],
|
||||
pageLength: products_get_saved_page_length(),
|
||||
layout: {
|
||||
topStart: null,
|
||||
topEnd: null,
|
||||
bottomStart: {
|
||||
rowClass: 'products-dt-footer',
|
||||
className: 'products-dt-info',
|
||||
features: [ 'info' ]
|
||||
},
|
||||
bottomEnd: {
|
||||
rowClass: 'products-dt-footer',
|
||||
className: 'products-dt-actions',
|
||||
features: [
|
||||
'paging',
|
||||
{
|
||||
pageLength: {
|
||||
menu: PRODUCTS_ALLOWED_PAGE_LENGTHS
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ width: '30px', orderable: false, className: 'select-checkbox', render: function( data, type, row ) {
|
||||
return '<input type="checkbox" class="product-checkbox" value="' + row[1] + '" />';
|
||||
@@ -748,9 +796,9 @@ $( function()
|
||||
{ width: '50px', name: 'cpc', className: "dt-type-numeric" },
|
||||
{ width: '50px', name: 'conversions' },
|
||||
{ width: '90px', name: 'conversions_value', className: "dt-type-numeric" },
|
||||
{ width: '60px', name: 'roas' },
|
||||
{ width: '50px', name: 'roas' },
|
||||
{ width: '70px', name: 'min_roas' },
|
||||
{ width: '120px', name: 'custom_label_1' },
|
||||
{ width: '180px', name: 'custom_label_1' },
|
||||
{ width: '120px', orderable: false },
|
||||
{ width: '190px', orderable: false, className: 'dt-center' }
|
||||
],
|
||||
@@ -766,6 +814,7 @@ $( function()
|
||||
emptyTable: 'Brak produktów do wyświetlenia',
|
||||
info: 'Produkty _START_ - _END_ z _TOTAL_',
|
||||
infoEmpty: '',
|
||||
lengthMenu: 'Pokaż _MENU_ produktów',
|
||||
paginate: {
|
||||
first: 'Pierwsza',
|
||||
last: 'Ostatnia',
|
||||
@@ -778,6 +827,10 @@ $( function()
|
||||
products_apply_saved_columns_visibility( products_table );
|
||||
products_render_columns_picker( products_table );
|
||||
|
||||
products_table.on( 'length.dt', function( e, settings, page_length ) {
|
||||
products_save_page_length( page_length );
|
||||
} );
|
||||
|
||||
$( '#products tbody' ).on( 'click', '.js-products-breakdown-toggle', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user