Skip to content

Commit

Permalink
[JS] add: check/uncheck all box in import shared risk
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Apr 22, 2022
1 parent 11ff04f commit 20073f6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
28 changes: 25 additions & 3 deletions js/digiriskdolibarr.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,7 @@
$( document ).on( 'click', '.risk-create:not(.button-disable)', window.eoxiaJS.risk.createRisk );
$( document ).on( 'click', '.risk-save', window.eoxiaJS.risk.saveRisk );
$( document ).on( 'click', '.risk-unlink-shared', window.eoxiaJS.risk.unlinkSharedRisk );
$( document ).on( 'click', '#select_all_shared_risks', window.eoxiaJS.risk.SelectAllSharedRisk );
};

/**
Expand Down Expand Up @@ -1830,10 +1831,10 @@
};

/**
* Action save risk.
* Action unlink shared risk.
*
* @since 1.0.0
* @version 9.0.0
* @since 9.2.0
* @version 9.2.0
*
* @return {void}
*/
Expand Down Expand Up @@ -1883,6 +1884,27 @@
});
};

/**
* Action select All shared risk.
*
* @since 9.2.0
* @version 9.2.0
*
* @return {void}
*/
window.eoxiaJS.risk.SelectAllSharedRisk = function ( event ) {
if(this.checked) {
// Iterate each checkbox
$(':checkbox').each(function() {
this.checked = true;
});
} else {
$(':checkbox').each(function() {
this.checked = false;
});
}
};

/**
* Initialise l'objet "evaluation" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS.
*
Expand Down
2 changes: 2 additions & 0 deletions view/digiriskelement/digiriskelement_risk.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@
'text' => '<i class="fas fa-circle-info"></i>' . $langs->trans("ConfirmImportSharedRisks"),
);

$formquestionimportsharedrisks[] = array('type' => 'checkbox', 'name' =>'select_all_shared_risks', 'value' => 1);

foreach ($allrisks as $key => $risks) {
$digiriskelementtmp->fetch($risks->fk_element);
$digiriskelementtmp->element = 'digiriskdolibarr';
Expand Down

0 comments on commit 20073f6

Please sign in to comment.