@@ -92,6 +92,15 @@ function onDetailsClick(id) {
92
92
} ) ;
93
93
}
94
94
95
+ function onToolbarClick ( args ) {
96
+ let grid = document . getElementById ( 'employees-list' ) . ej2_instances [ 0 ] ;
97
+ if ( args . item . id === 'employees-list_pdfexport' ) {
98
+ grid . pdfExport ( ) ;
99
+ } else if ( args . item . id === 'employees-list_excelexport' ) {
100
+ grid . excelExport ( ) ;
101
+ }
102
+ }
103
+
95
104
$ ( '#detailsModal' ) . on ( 'hidden.bs.modal' , function ( ) {
96
105
$ ( this ) . find ( '#detailsContent' ) . empty ( ) ;
97
106
} ) ;
@@ -135,3 +144,80 @@ $('#createModal').on('hidden.bs.modal', function () {
135
144
$ ( this ) . find ( '#accountModalContent' ) . empty ( ) ;
136
145
$ ( this ) . off ( 'hidden.bs.modal' ) ;
137
146
} ) ;
147
+
148
+ function exportToPdf ( ) {
149
+ let grid = document . getElementById ( 'employees-list' ) . ej2_instances [ 0 ] ;
150
+ grid . pdfExport ( {
151
+ includeHiddenColumn : true ,
152
+ fileName : 'xodimlar.pdf' ,
153
+ theme : {
154
+ header : {
155
+ fontName : 'Arial' ,
156
+ fontSize : 14 ,
157
+ size : 16 ,
158
+ bold : true ,
159
+ italic : false ,
160
+ color : '#FFFFFF' ,
161
+ background : '#4CAF50' // Header background color
162
+ } ,
163
+ record : {
164
+ fontName : 'Arial' ,
165
+ fontSize : 12 ,
166
+ size : 14 ,
167
+ color : '#000000'
168
+ } ,
169
+ caption : {
170
+ fontName : 'Arial' ,
171
+ fontSize : 12 ,
172
+ size : 14 ,
173
+ bold : true ,
174
+ color : '#333333' ,
175
+ background : '#f8f8f8'
176
+ }
177
+ } ,
178
+ header : {
179
+ fromTop : 0 ,
180
+ height : 130 ,
181
+ contents : [
182
+ {
183
+ width : 100 ,
184
+ height : 50 ,
185
+ type : 'Text' ,
186
+ value : 'ATP Garaj xodimlari' ,
187
+ position : { x : 250 , y : 50 } ,
188
+ style : { textBrushColor : '#3d3d3d' , fontSize : 24 , bold : true }
189
+ } ,
190
+ {
191
+ type : 'Text' ,
192
+ value : new Date ( ) . toLocaleDateString ( ) ,
193
+ position : { x : 600 , y : 100 } ,
194
+ style : { textBrushColor : '#1f1f1f' , fontSize : 16 }
195
+ }
196
+ ]
197
+ } ,
198
+ footer : {
199
+ fromBottom : 0 ,
200
+ height : 40 ,
201
+ contents : [
202
+ {
203
+ type : 'Text' ,
204
+ value : '© 2025 Silk Route Connect' ,
205
+ position : { x : 250 , y : 20 } ,
206
+ style : { textBrushColor : '#333333' , fontSize : 12 }
207
+ }
208
+ ]
209
+ } ,
210
+ columns : grid . getColumns ( ) . filter ( col => col . field !== null && col . field !== undefined )
211
+ } ) ;
212
+
213
+ grid . addEventListener ( 'pdfQueryCellInfo' , function ( args ) {
214
+ if ( args . cell ) {
215
+ args . style = {
216
+ padding : { top : 5 , right : 10 , bottom : 5 , left : 10 }
217
+ } ;
218
+ }
219
+ } ) ;
220
+ }
221
+
222
+ function exportToExcel ( ) {
223
+ }
0 commit comments