Disabled edit elements / create Anrechnung in GUI if user has readonly access / no permission to create Anrechnung

This commit is contained in:
Cris
2022-02-22 16:36:11 +01:00
parent 9abc018e08
commit 339f82291c
8 changed files with 118 additions and 10 deletions
@@ -10,6 +10,7 @@ $(function(){
const genehmigung_panel = $('#approveAnrechnungDetail-genehmigung-panel');
const begruendung_panel = $('#approveAnrechnungDetail-begruendung-panel');
const hasReadOnlyAccess = $('#approveAnrechnungDetail-generell').data('readonly');
// Pruefen ob Promise unterstuetzt wird
// Tabulator funktioniert nicht mit IE
@@ -21,6 +22,11 @@ $(function(){
return;
}
if (hasReadOnlyAccess)
{
approveAnrechnungDetail.disableEditElements();
}
// Set status alert color
approveAnrechnungDetail.setStatusAlertColor();
@@ -417,6 +423,34 @@ var approveAnrechnungDetail = {
}
);
},
disableEditElements: function()
{
// Disable:
// ...button Empfehlung anfordern
$('#approveAnrechnungDetail-request-recommendation')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ...button Empfehlung zuruecknehmen
$('#approveAnrechnungDetail-withdraw-request-recommedation')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ...button Genehmigen
$('#approveAnrechnungDetail-approve-anrechnung-ask')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ...button Ablehnen
$('#approveAnrechnungDetail-reject-anrechnung-ask')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ...button Genehmigung zurücknehmen
$('#approveAnrechnungDetail-withdraw-anrechnung-approvement')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ... form Empfehlungsnotiz
$('#form-empfehlungNotiz :input')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
},
copyIntoTextarea: function(elem){
// Find closest textarea
@@ -148,6 +148,8 @@ $(function(){
const genehmigung_panel = $('#approveAnrechnungUebersicht-genehmigung-panel');
const begruendung_panel = $('#approveAnrechnungUebersicht-begruendung-panel');
const hasReadOnlyAccess = $('#formApproveAnrechnungUebersicht').data('readonly');
const hasCreateAnrechnungAccess = $('#formApproveAnrechnungUebersicht').data('createaccess');
// Pruefen ob Promise unterstuetzt wird
// Tabulator funktioniert nicht mit IE
@@ -165,6 +167,16 @@ $(function(){
$('#tableWidgetTabulator').tabulator('redraw', true);
});
if (hasReadOnlyAccess)
{
approveAnrechnung.disableEditElements();
}
if (!hasCreateAnrechnungAccess)
{
approveAnrechnung.disableCreateAnrechnungButton();
}
// Set status alert color
approveAnrechnung.setStatusAlertColor();
@@ -517,6 +529,30 @@ var approveAnrechnung = {
$('#requestAnrechnung-status_kurzbz').closest('div').addClass('alert-warning');
}
},
disableEditElements: function()
{
// Disable:
// ...button Empfehlung anfordern
$('#approveAnrechnungUebersicht-request-recommendation')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ...button Ablehnen
$('#approveAnrechnungUebersicht-reject-anrechnungen-ask')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
// ...button Genehmigen
$('#approveAnrechnungUebersicht-approve-anrechnungen-ask')
.prop('disabled', true)
.attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
},
disableCreateAnrechnungButton: function()
{
// Disable button Antrag anlegen
$('#approveAnrechnungUebersicht-create-anrechnung')
.removeAttr('href')
.css({'color': 'grey', 'pointer-events': 'none'}); // property disabled does not work for <a> link
},
copyIntoTextarea: function(elem){
// Find closest textarea