@@ -28,18 +28,21 @@ along with this plugin. If not, see <http://www.gnu.org/licenses/>.
28
28
glpi_pm = {
29
29
add_tab_panel : function ( name , title , html ) {
30
30
//debugger ;
31
- var loctabs = $ ( '#tabspanel' ) . next ( 'div[id^=tabs]' ) ;
31
+ var loctabs = $ ( '#tabspanel' ) ;
32
32
if ( ! loctabs [ 0 ] . children [ name ] ) { // panel is not yet existing, create one
33
- if ( loctabs . find ( 'a[href =\"#' + name + '\"]' ) . length == 0 ) {
34
- loctabs . find ( 'ul' ) . append ( ' <li><a href=\ '#' + name + '\'>' + title + ' </a></li>' ) ;
33
+ if ( loctabs . find ( 'a[data-bs-target =\"#' + name + '\"]' ) . length == 0 ) {
34
+ loctabs . append ( " <li class='nav-item ms-0' ><a class='nav-link justify-content-between pe-1' href='#' data-bs-toggle='tab' title='" + title + "' data-bs-target='#" + name + "'>" + title + " </a></li>" ) ;
35
35
}
36
-
37
- loctabs . append ( '<div id=\'' + name + '\'>' + html + '</div>' ) ;
38
- loctabs . tabs ( 'refresh' ) ; // to show the panel
36
+ var select = loctabs . next ( 'select' ) ;
37
+ select . append ( "<option value='" + ( parseInt ( select . children ( ) . last ( ) . val ( ) ) + 1 ) + "'>" + title + "</option >" )
38
+ var tabcontentdiv = select . next ( 'div' ) ;
39
+ tabcontentdiv . append ( "<div class='tab-pane fade' role='tabpanel' id='" + name + "'>" + html + "</div>" ) ;
40
+ $ ( "a[data-bs-target='#" + name + "']" ) . tab ( "show" ) ;
41
+ //tabcontentdiv.tabs('refresh'); // to show the panel
39
42
}
40
43
// activate it
41
- var tabIndex = loctabs . find ( 'a[href=\"#' + name + '\"]' ) . parent ( ) . index ( ) ;
42
- loctabs . tabs ( 'option' , 'active' , tabIndex ) ; // to activate it
44
+ // var tabIndex = loctabs.find('a[href=\"#'+name+'\"]').parent().index();
45
+ // loctabs.tabs( 'option', 'active', tabIndex) ; // to activate it
43
46
} ,
44
47
45
48
0 commit comments