Files
roi-theme/wp-content/plugins/wp-marketing-automations-pro/admin/assets/js/bwfan-pro-admin-bar.js
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

50 lines
2.2 KiB
JavaScript
Executable File

( function ( $ ) {
$( document ).ready( function () {
const adminSearchBar = $( '#bwfan-admin-bar-search' );
adminSearchBar.on( 'keyup', function () {
let value = $( this ).val();
if ( value ) {
fetch(
bwfanProObj.siteUrl+'/wp-json/' + bwfanProObj.apiNamespace + '/contacts?search=' +
value +
'&limit=5&offset=0',
{
credentials: 'include',
headers: {
'content-type': 'application/json',
'X-WP-Nonce': wpApiSettings.nonce,
},
}
)
.then( ( response ) => response.json() )
.then( function ( result ) {
if ( result.code == 200 ) {
let res = result.result;
let template = '';
if ( res.length > 0 ) {
res.map( function ( contact ) {
if (
contact.hasOwnProperty( 'email' ) &&
contact.hasOwnProperty( 'id' )
) {
template +=
'<a class="bwf-contact-suggestion" target="_blank" href="'+bwfanProObj.siteUrl+'/wp-admin/admin.php?page=autonami&path=/contact/' +
contact.id +
'">' +
contact.email +
'</a>';
}
} );
} else {
template = '<span class="label">No contacts found</span>';
}
$( '#bwf-contact-list-suggestion-list' ).html(
template
);
}
} );
}
} );
} );
} )( jQuery );