|
38 | 38 | <thead> |
39 | 39 | <tr> |
40 | 40 | <th width="5" class="text-center">'; |
41 | | -if (!$block_edit && sizeof($righe) > 0) { |
| 41 | +if (sizeof($righe) > 0) { |
42 | 42 | echo ' |
43 | 43 | <input id="check_all" type="checkbox"/>'; |
44 | 44 | } |
|
90 | 90 | echo ' |
91 | 91 | <tr data-id="'.$riga->id.'" data-type="'.$riga::class.'"> |
92 | 92 | <td class="text-center">'; |
93 | | - if (!$block_edit) { |
94 | | - echo ' |
| 93 | + echo ' |
95 | 94 | <input class="check" type="checkbox"/>'; |
96 | | - } |
97 | 95 | echo ' |
98 | 96 | </td> |
99 | 97 |
|
|
434 | 432 |
|
435 | 433 | echo ' |
436 | 434 | </table>'; |
437 | | -if (!$block_edit && sizeof($righe) > 0) { |
| 435 | +if (sizeof($righe) > 0) { |
438 | 436 | echo ' |
439 | | - <div class="btn-group"> |
| 437 | + <div class="btn-group">'; |
| 438 | + if (!$block_edit) { |
| 439 | + echo ' |
440 | 440 | <button type="button" class="btn btn-xs btn-default disabled" id="duplica_righe" onclick="duplicaRiga(getSelectData());"> |
441 | 441 | <i class="fa fa-copy"></i> |
442 | 442 | </button> |
443 | 443 |
|
444 | 444 | <button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());"> |
445 | 445 | <i class="fa fa-trash"></i> |
446 | 446 | </button>'; |
447 | | - if ($dir == 'entrata') { |
448 | | - echo ' |
| 447 | + if ($dir == 'entrata') { |
| 448 | + echo ' |
449 | 449 | <button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());"> |
450 | 450 | '.tr('Confronta prezzi').' |
451 | 451 | </button>'; |
452 | | - } |
453 | | - echo ' |
| 452 | + } |
| 453 | + echo ' |
454 | 454 | <button type="button" class="btn btn-xs btn-default disabled" id="aggiorna_righe" onclick="aggiornaRighe(getSelectData());"> |
455 | 455 | '.tr('Aggiorna prezzi').' |
456 | 456 | </button> |
|
461 | 461 |
|
462 | 462 | <button type="button" class="btn btn-xs btn-default disabled" id="stampa_barcode_righe" onclick="stampaBarcodeDDT(getSelectData());"> |
463 | 463 | <i class="fa fa-barcode"></i> '.tr('Stampa barcode').' |
464 | | - </button> |
465 | | -
|
| 464 | + </button>'; |
| 465 | + } |
| 466 | + echo ' |
466 | 467 | <button type="button" class="btn btn-xs btn-primary disabled" id="copia_righe" onclick="copiaRighe(getSelectData());" title="'.tr('Copia righe selezionate negli appunti').'"> |
467 | 468 | <i class="fa fa-clipboard"></i> '.tr('Copia').' |
468 | | - </button> |
| 469 | + </button>'; |
469 | 470 |
|
| 471 | + // Il tasto incolla è disponibile solo se il documento non è bloccato |
| 472 | + if (!$block_edit) { |
| 473 | + echo ' |
470 | 474 | <button type="button" class="btn btn-xs btn-primary" id="incolla_righe" onclick="incollaRighe();" title="'.tr('Incolla righe dagli appunti').'"> |
471 | 475 | <i class="fa fa-paste"></i> '.tr('Incolla').' |
472 | | - </button> |
473 | | - </div>'; |
474 | | -} |
475 | | -if (!$block_edit && sizeof($righe) == 0) { |
| 476 | + </button>'; |
| 477 | + } |
476 | 478 | echo ' |
| 479 | + </div>'; |
| 480 | +} else { |
| 481 | + // Anche quando non ci sono righe, il tasto incolla è disponibile solo se il documento non è bloccato |
| 482 | + if (!$block_edit) { |
| 483 | + echo ' |
477 | 484 | <div class="btn-group"> |
478 | 485 | <button type="button" class="btn btn-xs btn-primary" id="incolla_righe" onclick="incollaRighe();" title="'.tr('Incolla righe dagli appunti').'"> |
479 | 486 | <i class="fa fa-paste"></i> '.tr('Incolla').' |
480 | 487 | </button> |
481 | 488 | </div>'; |
| 489 | + } |
482 | 490 | } |
483 | 491 | echo ' |
484 | 492 | </div> |
@@ -755,23 +763,37 @@ function incollaRighe() { |
755 | 763 | }); |
756 | 764 |
|
757 | 765 | if (checked) { |
| 766 | + // Pulsanti sempre attivi anche se documento bloccato |
| 767 | + $("#copia_righe").removeClass("disabled"); |
| 768 | +
|
| 769 | + // Pulsanti attivi solo se documento non bloccato'; |
| 770 | + if (!$block_edit) { |
| 771 | +echo ' |
758 | 772 | $("#elimina_righe").removeClass("disabled"); |
759 | 773 | $("#duplica_righe").removeClass("disabled"); |
760 | 774 | $("#confronta_righe").removeClass("disabled"); |
761 | 775 | $("#aggiorna_righe").removeClass("disabled"); |
762 | 776 | $("#modifica_iva_righe").removeClass("disabled"); |
763 | 777 | $("#stampa_barcode_righe").removeClass("disabled"); |
764 | | - $("#copia_righe").removeClass("disabled"); |
765 | | - $("#elimina").addClass("disabled"); |
| 778 | + $("#elimina").addClass("disabled");'; |
| 779 | + } |
| 780 | +echo ' |
766 | 781 | } else { |
| 782 | + // Pulsanti sempre disabilitati quando nessuna riga è selezionata |
| 783 | + $("#copia_righe").addClass("disabled"); |
| 784 | +
|
| 785 | + // Pulsanti disabilitati solo se documento non bloccato'; |
| 786 | + if (!$block_edit) { |
| 787 | +echo ' |
767 | 788 | $("#elimina_righe").addClass("disabled"); |
768 | 789 | $("#duplica_righe").addClass("disabled"); |
769 | 790 | $("#confronta_righe").addClass("disabled"); |
770 | 791 | $("#aggiorna_righe").addClass("disabled"); |
771 | 792 | $("#modifica_iva_righe").addClass("disabled"); |
772 | 793 | $("#stampa_barcode_righe").addClass("disabled"); |
773 | | - $("#copia_righe").addClass("disabled"); |
774 | | - $("#elimina").removeClass("disabled"); |
| 794 | + $("#elimina").removeClass("disabled");'; |
| 795 | + } |
| 796 | +echo ' |
775 | 797 | } |
776 | 798 | }); |
777 | 799 |
|
|
0 commit comments