update
This commit is contained in:
@@ -195,17 +195,38 @@
|
||||
}
|
||||
|
||||
.products-page .products-breakdown-toggle {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
color: #374151;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color .15s ease, color .15s ease, transform .2s ease;
|
||||
outline: none;
|
||||
}
|
||||
.products-page .products-breakdown-toggle:hover {
|
||||
background: #eef2ff;
|
||||
color: #4338ca;
|
||||
}
|
||||
.products-page .products-breakdown-toggle:focus-visible {
|
||||
box-shadow: 0 0 0 2px rgba( 99, 102, 241, .35 );
|
||||
}
|
||||
.products-page .products-breakdown-toggle i {
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
transition: transform .2s ease;
|
||||
}
|
||||
.products-page tr.products-breakdown-open .products-breakdown-toggle {
|
||||
background: #4338ca;
|
||||
color: #fff;
|
||||
}
|
||||
.products-page tr.products-breakdown-open .products-breakdown-toggle i {
|
||||
transform: rotate( 90deg );
|
||||
}
|
||||
|
||||
.products-page .products-breakdown-wrap {
|
||||
@@ -236,6 +257,12 @@
|
||||
.products-page .products-breakdown-table td:nth-child(16) {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.products-page .products-breakdown-table th:last-child,
|
||||
.products-page .products-breakdown-table td:last-child {
|
||||
width: 56px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
@@ -627,6 +654,7 @@ function products_build_breakdown_html( row_meta )
|
||||
'<th>Min. ROAS</th>' +
|
||||
'<th>CL1</th>' +
|
||||
'<th>CL4</th>' +
|
||||
'<th>Akcje</th>' +
|
||||
'</tr></thead><tbody>';
|
||||
|
||||
rows.forEach( function( entry ) {
|
||||
@@ -646,6 +674,16 @@ function products_build_breakdown_html( row_meta )
|
||||
'<td>' + products_breakdown_number( entry.min_roas, 2 ) + '</td>' +
|
||||
'<td>' + escape_html( entry.custom_label_1 || '' ) + '</td>' +
|
||||
'<td>' + escape_html( entry.custom_label_4 || '' ) + '</td>' +
|
||||
'<td class="text-center">' +
|
||||
'<button type="button" class="btn btn-sm btn-danger js-products-breakdown-delete" title="Usun wpisy historii dla tej kampanii+grupy"' +
|
||||
' data-product-id="' + ( parseInt( entry.product_id, 10 ) || 0 ) + '"' +
|
||||
' data-campaign-id="' + ( parseInt( entry.campaign_id, 10 ) || 0 ) + '"' +
|
||||
' data-ad-group-id="' + ( parseInt( entry.ad_group_id, 10 ) || 0 ) + '"' +
|
||||
' data-campaign-name="' + escape_html( entry.campaign_name || '' ) + '"' +
|
||||
' data-ad-group-name="' + escape_html( entry.ad_group_name || '' ) + '">' +
|
||||
'<i class="fa-solid fa-trash"></i>' +
|
||||
'</button>' +
|
||||
'</td>' +
|
||||
'</tr>';
|
||||
} );
|
||||
|
||||
@@ -754,14 +792,81 @@ $( function()
|
||||
dt_row.child.hide();
|
||||
$tr.removeClass( 'products-breakdown-open' );
|
||||
$btn.attr( 'aria-expanded', 'false' );
|
||||
$btn.find( 'i' ).removeClass( 'fa-chevron-down' ).addClass( 'fa-chevron-right' );
|
||||
return;
|
||||
}
|
||||
|
||||
dt_row.child( products_build_breakdown_html( row_meta ) ).show();
|
||||
$tr.addClass( 'products-breakdown-open' );
|
||||
$btn.attr( 'aria-expanded', 'true' );
|
||||
$btn.find( 'i' ).removeClass( 'fa-chevron-right' ).addClass( 'fa-chevron-down' );
|
||||
} );
|
||||
|
||||
$( '#products' ).on( 'click', '.js-products-breakdown-delete', function( e ) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var $btn = $( this );
|
||||
var product_id = parseInt( $btn.data( 'product-id' ), 10 ) || 0;
|
||||
var campaign_id = parseInt( $btn.data( 'campaign-id' ), 10 ) || 0;
|
||||
var ad_group_id = parseInt( $btn.data( 'ad-group-id' ), 10 ) || 0;
|
||||
var campaign_nm = String( $btn.data( 'campaign-name' ) || '' );
|
||||
var ad_group_nm = String( $btn.data( 'ad-group-name' ) || '' );
|
||||
var $tr = $btn.closest( 'tr' );
|
||||
|
||||
if ( product_id <= 0 ) { return; }
|
||||
|
||||
$.confirm( {
|
||||
title: 'Usun wpisy historii',
|
||||
content: 'Czy na pewno chcesz usunac wpisy statystyk i historii tego produktu w kampanii <strong>'
|
||||
+ escape_html( campaign_nm ) + '</strong> / grupie <strong>' + escape_html( ad_group_nm ) + '</strong>?'
|
||||
+ '<br><br><small>Operacja usuwa wpisy z products_aggregate, products_history oraz products_history_30 dla tej kombinacji. Nie usuwa produktu z tabeli products ani z Google Ads.</small>',
|
||||
type: 'red',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Usun',
|
||||
btnClass: 'btn-danger',
|
||||
action: function() {
|
||||
$btn.prop( 'disabled', true );
|
||||
$.ajax( {
|
||||
url: '/products/delete_product_scope_history/',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
product_id: product_id,
|
||||
campaign_id: campaign_id,
|
||||
ad_group_id: ad_group_id
|
||||
},
|
||||
success: function( res ) {
|
||||
if ( res && res.status === 'ok' ) {
|
||||
$tr.remove();
|
||||
if ( typeof products_table !== 'undefined' && products_table ) {
|
||||
products_table.ajax.reload( null, false );
|
||||
}
|
||||
show_toast( 'Usunieto wpisy historii dla wybranego zakresu.', 'success' );
|
||||
} else {
|
||||
$btn.prop( 'disabled', false );
|
||||
$.alert( {
|
||||
title: 'Blad',
|
||||
type: 'red',
|
||||
content: ( res && res.message ) ? res.message : 'Nie udalo sie usunac wpisow.'
|
||||
} );
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$btn.prop( 'disabled', false );
|
||||
$.alert( {
|
||||
title: 'Blad',
|
||||
type: 'red',
|
||||
content: 'Blad polaczenia z serwerem.'
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: 'Anuluj'
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
function reload_products_table()
|
||||
|
||||
Reference in New Issue
Block a user