UI: globalny auto-init Select2 z wyszukiwarka dla selectow >4 opcji
- Nowy libraries/adspro-select2-autoinit.js (auto-init na document.ready + ajaxComplete debounce 150ms) - Wyszukiwarka odblokowana dla "Grupa reklam", "Kampania", "Klient" na /campaign_terms (data-adspro-select2="true") - Globalne style Select2 w layout/style.scss i style.css (uogolnione z .products-page) - Usuniety duplikat: blok CSS .products-page .select2-* i funkcja init_products_scope_select_search() w products PAUL: phase 10-select2-global-search complete (plan 10-01) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<div class="campaigns-filters">
|
||||
<div class="filter-group">
|
||||
<label for="terms_client_id"><i class="fa-solid fa-building"></i> Klient</label>
|
||||
<select id="terms_client_id" name="terms_client_id" class="form-control">
|
||||
<select id="terms_client_id" name="terms_client_id" class="form-control" data-adspro-select2="true">
|
||||
<option value="">- wybierz klienta -</option>
|
||||
<?php foreach ( $this -> clients as $client ): ?>
|
||||
<option value="<?= $client['id']; ?>"><?= htmlspecialchars( $client['name'] ); ?></option>
|
||||
@@ -15,13 +15,13 @@
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="terms_campaign_id"><i class="fa-solid fa-bullhorn"></i> Kampania</label>
|
||||
<select id="terms_campaign_id" name="terms_campaign_id" class="form-control">
|
||||
<select id="terms_campaign_id" name="terms_campaign_id" class="form-control" data-adspro-select2="true">
|
||||
<option value="">- wybierz kampanie -</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label for="terms_ad_group_id"><i class="fa-solid fa-layer-group"></i> Grupa reklam</label>
|
||||
<select id="terms_ad_group_id" name="terms_ad_group_id" class="form-control">
|
||||
<select id="terms_ad_group_id" name="terms_ad_group_id" class="form-control" data-adspro-select2="true">
|
||||
<option value="">- wszystkie grupy -</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -1738,6 +1738,12 @@ function load_ad_groups()
|
||||
$ad_group_select.val( saved_ad_group_id );
|
||||
}
|
||||
|
||||
if ( typeof window.adsproSelect2Init === 'function' )
|
||||
{
|
||||
window.adsproSelect2Init( $ad_group_select.parent() );
|
||||
}
|
||||
$ad_group_select.trigger( 'change.select2' );
|
||||
|
||||
load_phrase_tables();
|
||||
}
|
||||
});
|
||||
@@ -1791,6 +1797,12 @@ function load_campaigns_for_client( restore_campaign_id )
|
||||
$campaign_select.val( restore_campaign_id );
|
||||
}
|
||||
|
||||
if ( typeof window.adsproSelect2Init === 'function' )
|
||||
{
|
||||
window.adsproSelect2Init( $campaign_select.parent() );
|
||||
}
|
||||
$campaign_select.trigger( 'change.select2' );
|
||||
|
||||
load_ad_groups();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -133,61 +133,6 @@
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.products-page .select2-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.products-page .select2-container--default .select2-selection--single {
|
||||
height: 38px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.products-page .select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height: 36px;
|
||||
padding-left: 12px;
|
||||
padding-right: 36px;
|
||||
font-size: 14px;
|
||||
color: #2d3748;
|
||||
}
|
||||
|
||||
.products-page .select2-container--default .select2-selection--single .select2-selection__placeholder {
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
.products-page .select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 36px;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
.products-page .select2-container--default.select2-container--focus .select2-selection--single {
|
||||
border-color: #6690f4;
|
||||
box-shadow: 0 0 0 3px rgba(102, 144, 244, 0.1);
|
||||
}
|
||||
|
||||
.products-page .select2-dropdown {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.products-page .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 6px;
|
||||
height: 34px;
|
||||
padding: 6px 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.products-page .select2-results__option {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.products-page .select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #6690f4;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.products-page .products-id-cell {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -607,29 +552,6 @@ function products_render_columns_picker( table_instance )
|
||||
}
|
||||
}
|
||||
|
||||
function init_products_scope_select_search()
|
||||
{
|
||||
if ( typeof $.fn.select2 === 'undefined' )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[ '#products_campaign_id', '#products_ad_group_id' ].forEach( function( selector ) {
|
||||
var $select = $( selector );
|
||||
|
||||
if ( !$select.length || $select.data( 'products-select2-ready' ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$select.select2({
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
$select.data( 'products-select2-ready', true );
|
||||
} );
|
||||
}
|
||||
|
||||
function products_breakdown_number( value, digits )
|
||||
{
|
||||
var num = Number( value || 0 );
|
||||
@@ -720,8 +642,6 @@ function products_build_breakdown_html( row_meta )
|
||||
|
||||
$( function()
|
||||
{
|
||||
init_products_scope_select_search();
|
||||
|
||||
var products_table = new DataTable( '#products', {
|
||||
stateSave: true,
|
||||
ajax: {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/libraries/select2/css/select2-bootstrap-5-theme.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="/layout/style.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="/libraries/adspro-select2-autoinit.js"></script>
|
||||
</head>
|
||||
<body class="logged">
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user