@@ -22,19 +22,14 @@ function tandasStyler(val,row,idx) {
22
22
return str ;
23
23
}
24
24
25
- /******************* funciones de manejo del panel de orden de tandas y orden de salida en el tablet *******************/
25
+ /******************* funciones de manejo de las ventana de orden de tandas y orden de salida en el tablet *******************/
26
26
27
- /**
28
- * expande/contrae activa/desactiva entrada de datos en el tablet
29
- * @param {boolean } flag true if activate; false on deactivate
30
- */
31
- function setDataEntryEnabled ( flag ) {
32
- $ ( '#tdialog-fieldset' ) . prop ( 'disabled' , ! flag ) ;
33
- if ( flag ) $ ( '#tablet-layout' ) . layout ( 'collapse' , 'west' ) ;
34
- else $ ( '#tablet-layout' ) . layout ( 'expand' , 'west' ) ;
27
+ function tablet_showOrdenSalida ( ) {
28
+ $ ( '#tablet-window' ) . window ( 'open' ) ;
29
+ $ ( '#tdialog-window' ) . window ( 'close' ) ;
35
30
}
36
31
37
- /******************* funciones de manejo del panel de entrada de resultados del tablet *****************/
32
+ /******************* funciones de manejo de la ventana de entrada de resultados del tablet *****************/
38
33
39
34
/**
40
35
* send events
@@ -79,8 +74,8 @@ function tablet_updateSession(row) {
79
74
Tanda : row . ID
80
75
} ;
81
76
if ( parseInt ( row . Manga ) == 0 ) {
82
- var str = row . Nombre . toLowerCase ( ) ;
83
- if ( str . indexOf ( "econo" ) > 0 ) return false ;
77
+ var str = strval ( row . Nombre ) . toLowerCase ( ) ;
78
+ if ( strpos ( str , "econo" ) > 0 ) return false ;
84
79
else tablet_reconocimiento ( ) ;
85
80
}
86
81
$ . ajax ( {
@@ -320,8 +315,7 @@ function tablet_cancel() {
320
315
doBeep ( ) ;
321
316
// retrieve original data from parent datagrid
322
317
var dgname = $ ( '#tdialog-Parent' ) . val ( ) ;
323
- var dg = $ ( dgname ) . datagrid ( ) ;
324
- var row = dg . datagrid ( 'getSelected' ) ;
318
+ var row = $ ( dgname ) . datagrid ( 'getSelected' ) ;
325
319
if ( row ) {
326
320
// update database according row data
327
321
row . Operation = 'update' ;
@@ -345,31 +339,14 @@ function tablet_cancel() {
345
339
) ;
346
340
}
347
341
} ) ;
348
- var index = row = dg . datagrid ( 'getRowIndex' , row ) ;
349
- dg . datagrid ( 'scrollTo' , index ) ;
350
342
}
351
343
// and close panel
352
344
tablet_cronoManual ( 'stop' ) ;
353
345
tablet_cronoManual ( 'reset' ) ;
354
- setDataEntryEnabled ( false ) ;
346
+ $ ( '#tdialog-window' ) . window ( 'close' ) ;
355
347
return false ;
356
348
}
357
349
358
- function nextRow ( dg , cb ) {
359
- var opts = dg . datagrid ( 'options' ) ;
360
- var row = dg . datagrid ( 'getSelected' ) ;
361
- var index = dg . datagrid ( 'getRowIndex' , row ) ;
362
- if ( index >= ( opts . numRows - 1 ) ) return false ;
363
- dg . datagrid ( 'scrollTo' , {
364
- index : index + 1 ,
365
- callback : function ( index ) {
366
- $ ( this ) . datagrid ( 'selectRow' , index ) ;
367
- cb ( index , $ ( this ) . datagrid ( 'getRows' ) [ index ] ) ;
368
- }
369
- } ) ;
370
- return true ;
371
- }
372
-
373
350
function tablet_accept ( ) {
374
351
doBeep ( ) ;
375
352
// save results
@@ -409,102 +386,32 @@ function tablet_accept() {
409
386
tablet_cronoManual ( 'reset' ) ;
410
387
}
411
388
if ( ! ac_config . tablet_next ) { // no go to next row entry
412
- setDataEntryEnabled ( false ) ;
389
+ $ ( '#tdialog-window' ) . window ( 'close' ) ; // close window
413
390
dg . datagrid ( 'refreshRow' , rowindex ) ;
414
391
return false ;
415
392
}
416
393
// seleccionamos fila siguiente
417
- var res = nextRow ( dg , function ( index , data ) {
418
- // alert ("index:"+index+" data:"+JSON.stringify(data));
419
- if ( index < 0 ) return false ; // no selection
420
- if ( data == null ) { // at end of rows. should not occurs
421
- dg . datagrid ( 'scrollTo' , rowindex ) ;
422
- setDataEntryEnabled ( false ) ;
423
- return false ;
424
- }
425
- data . Session = workingData . sesion ;
426
- data . RowIndex = index ; // not really used, but....
427
- data . Parent = dgname ; // store datagrid reference
428
- $ ( '#tdialog-form' ) . form ( 'load' , data ) ;
429
- } ) ;
430
- if ( res == false ) { // at end of list
431
- setDataEntryEnabled ( false ) ;
432
- dg . datagrid ( 'refreshRow' , rowindex ) ;
433
- }
434
- return false ; // prevent follow onClick event chain
435
- }
436
-
437
- /**
438
- * retrieve from server data row on provided dorsal
439
- * call to callback(idx,row) provided function
440
- * @param {array } tanda current selected tanda
441
- * @param {object } dg datagrid for current selected tanda
442
- * @param {int } dorsal Dog dorsal to search for
443
- * @param cb(page) what to do if Dorsal found in tanda
444
- */
445
- function loadDorsalPage ( tanda , dg , dorsal , cb ) {
446
- $ . ajax ( {
447
- type : 'GET' ,
448
- url : "/agility/server/database/tandasFunctions.php" ,
449
- dataType :'json' ,
450
- data : {
451
- Operation : 'getDataByDorsal' ,
452
- Prueba : tanda . Prueba ,
453
- Jornada : tanda . Jornada ,
454
- Sesion : tanda . Sesion ,
455
- ID : tanda . ID ,
456
- Dorsal : dorsal
457
- } ,
458
- success : function ( row ) {
459
- var idx = row . RowIndex ;
460
- if ( idx < 0 ) {
461
- $ . messager . alert ( "Not found" , "El perro con dorsal " + dorsal + " no participa en esta manga" , "info" ) ;
462
- $ ( '#tablet-datagrid-search' ) . val ( '---- Dorsal ----' ) ;
463
- return false ;
464
- }
465
- cb ( idx ) ;
466
- } ,
467
- error : function ( XMLHttpRequest , textStatus , errorThrown ) {
468
- alert ( "error: " + textStatus + " " + errorThrown ) ;
469
- }
470
- } ) ;
471
- }
472
-
473
- function tablet_editByDorsal ( ) {
474
- var i , len ;
475
- var dg = $ ( '#tablet-datagrid' ) ;
476
- var drs = $ ( '#tablet-datagrid-search' ) ;
477
- var rows = dg . datagrid ( 'getRows' ) ;
478
- var dorsal = parseInt ( drs . val ( ) ) ;
479
- drs . blur ( ) ; // remove focus to hide tooltip
480
- // si no hay tandas activas muestra error e ignora
481
- for ( i = 0 , len = rows . length ; i < len ; i ++ ) {
482
- if ( typeof ( rows [ i ] . expanded ) === "undefined" ) continue ;
483
- if ( rows [ i ] . expanded == 0 ) continue ;
484
- // obtenemos el datagrid y buscamos el dorsal
485
- var dgname = '#tablet-datagrid-' + rows [ i ] . ID ;
486
- var dg2 = $ ( dgname ) ;
487
- loadDorsalPage ( rows [ i ] , dg2 , dorsal , function ( idx ) {
488
- dg2 . datagrid ( 'scrollTo' , {
489
- index : idx ,
490
- callback : function ( index ) {
491
- if ( index < 0 ) return false ; // no selection
492
- dg2 . datagrid ( 'selectRow' , index ) ;
493
- var data = dg2 . datagrid ( 'getRows' ) [ index ] ;
494
- data . Session = workingData . sesion ;
495
- data . RowIndex = index ; // not really used, but....
496
- data . Parent = dgname ; // store datagrid reference
497
- $ ( '#tdialog-form' ) . form ( 'load' , data ) ;
498
- setDataEntryEnabled ( true ) ;
499
- }
500
- } ) ;
501
- } ) ;
502
- drs . val ( '---- Dorsal ----' ) ;
394
+ /*
395
+ var count=dg.datagrid('getRows').length; // row count
396
+ if ( (rowindex)>=count ) { // at end of datagrid
397
+ $('#tdialog-window').window('close'); // close window
398
+ dg.datagrid('refreshRow',rowindex-1);
399
+ return false;
400
+ }
401
+ */
402
+ dg . datagrid ( 'scrollTo' , rowindex + 1 ) ;
403
+ dg . datagrid ( 'selectRow' , rowindex + 1 ) ;
404
+ var data = dg . datagrid ( 'getSelected' ) ;
405
+ if ( data == null ) { // at end of datagrid
406
+ $ ( '#tdialog-window' ) . window ( 'close' ) ; // close window
407
+ dg . datagrid ( 'refreshRow' , rowindex ) ;
503
408
return false ;
504
409
}
505
- // arriving here means that there are no expanded row
506
- $ . messager . alert ( "No selection" , "No hay ninguna manga seleccionada" , "error" ) ;
507
- drs . val ( '---- Dorsal ----' ) ;
410
+ data . Session = workingData . sesion ;
411
+ data . RowIndex = rowindex ; // not really used, but....
412
+ data . Parent = dgname ; // store datagrid reference
413
+ $ ( '#tdialog-form' ) . form ( 'load' , data ) ;
414
+ return false ; // prevent follow onClick event chain
508
415
}
509
416
510
417
function isExpected ( event ) {
0 commit comments