@@ -28,7 +28,7 @@ $.when($.getScript("js/global/global.js")).then(function () {
2828 $ ( '#addEntryModal' ) . on ( 'hidden.bs.modal' , { extra : "#addEntryModal" } , modalFormCleaner ) ;
2929
3030 var config = new TableConfigurationsServerSide ( "testTable" , "ReadTest" , "contentTable" , aoColumnsFunc ( ) , [ 1 , 'asc' ] ) ;
31- var table = createDataTableWithPermissions ( config , renderOptionsForTest , "#testList" , undefined , true ) ;
31+ var table = createDataTableWithPermissionsNew ( config , renderOptionsForTest , "#testList" , undefined , true ) ;
3232
3333 $ ( '[data-toggle="popover"]' ) . popover ( {
3434 'placement' : 'auto' ,
@@ -68,10 +68,25 @@ function renderOptionsForTest(data) {
6868
6969 if ( data [ "hasPermissions" ] ) {
7070 if ( $ ( "#createTestButton" ) . length === 0 ) {
71- var contentToAdd = "<div class='marginBottom10'><button id='createTestButton' type='button' class='btn btn-default'>\n\
72- <span class='glyphicon glyphicon-plus-sign'></span> " + doc . getDocLabel ( "page_test" , "btn_create" ) + "</button></div>" ;
73-
74- $ ( "#testTable_wrapper div#testTable_length" ) . before ( contentToAdd ) ;
71+ var contentToAdd = "" ;
72+ // Bouton Create
73+ contentToAdd += `
74+ <button id='createTestButton' type='button'
75+ class='bg-sky-400 hover:bg-sky-500 flex items-center space-x-1 px-3 py-1 rounded-lg h-10 w-auto'>
76+ <span class='glyphicon glyphicon-plus-sign'></span>
77+ <span>${ doc . getDocLabel ( "page_test" , "btn_create" ) } </span>
78+ </button>
79+ ` ;
80+
81+ var $wrapper = $ ( "#testTable_buttonWrapper" ) ;
82+ if ( $wrapper . length ) {
83+ // Ajoute le bouton au **début** du wrapper
84+ $wrapper . append ( contentToAdd ) ;
85+ } else {
86+ // fallback si le wrapper n’existe pas encore
87+ console . warn ( "Wrapper #testTable_buttonWrapper introuvable, insertion avant length" ) ;
88+ $ ( "#testTable_wrapper div#testTable_length" ) . before ( "<div id='testTable_buttonWrapper' class='flex w-full gap-2'>" + contentToAdd + "</div>" ) ;
89+ }
7590 $ ( '#testList #createTestButton' ) . click ( addEntryClick ) ;
7691 }
7792 }
0 commit comments