diff --git a/tempjpwNow/IndivLendHome.html b/tempjpwNow/IndivLendHome.html index 1e693d8ee..414b8f84d 100644 --- a/tempjpwNow/IndivLendHome.html +++ b/tempjpwNow/IndivLendHome.html @@ -1212,9 +1212,9 @@ - - - + + + @@ -1252,8 +1252,8 @@
{{=$ctx.doI18N("table.heading.permission.type")}}{{=$ctx.doI18N("table.heading.permission.permission")}}{{=$ctx.doI18N("table.heading.permission.description")}}
- - + + @@ -1263,10 +1263,8 @@ {{/each}} @@ -1308,21 +1306,21 @@
{{=$ctx.doI18N("form.legend.user.details")}} - + - + - + - + - + {{#each availableRoles}} {{/each}} - >> + {{=$ctx.doI18N("widget.multiselect.button.add")}} >>
- + - << + << {{=$ctx.doI18N("widget.multiselect.button.remove")}}
@@ -1360,23 +1358,23 @@
- + {{=$ctx.doI18N("form.legend.role.details")}} - + - +
- + - >> + {{=$ctx.doI18N("widget.multiselect.button.add")}} >>
@@ -1386,7 +1384,7 @@ {{/each}} - << + << {{=$ctx.doI18N("widget.multiselect.button.remove")}}
diff --git a/tempjpwNow/resources/jsrenderExtra.js b/tempjpwNow/resources/jsrenderExtra.js index 47b59bbbf..5c528afaf 100644 --- a/tempjpwNow/resources/jsrenderExtra.js +++ b/tempjpwNow/resources/jsrenderExtra.js @@ -131,22 +131,21 @@ function setOrgAdminContent(divName) { function setUserAdminContent(divName) { - var addLoanProductUrl = "maintainLoanProduct('loanproducts/template', 'loanproducts', 'POST', 'dialog.title.add.loan.product');return false;"; - var addOfficeUrl = "maintainOffice('offices/template', 'offices', 'POST', 'dialog.title.add.office');return false;"; - var orgCurrenciesUrl = "maintainOrgCurrencies('configurations/currency', 'configurations/currency', 'PUT', 'dialog.title.configuration.currencies');return false;"; + var addUserUrl = "maintainUser('users/template', 'users', 'POST', 'dialog.title.add.user');return false;"; + var addRoleUrl = "maintainRole('roles/template', 'roles', 'POST', 'dialog.title.add.role');return false;"; var htmlVar = '
' var htmlVar = '
'; htmlVar += ''; htmlVar += ' ' + doI18N("administration.link.view.users") + ''; htmlVar += ' | '; - htmlVar += ' ' + doI18N("administration.link.add.user") + ''; + htmlVar += ' ' + doI18N("administration.link.add.user") + ''; htmlVar += ' | '; - htmlVar += ' ' + doI18N("administration.link.view.roles") + ''; + htmlVar += ' ' + doI18N("administration.link.view.roles") + ''; htmlVar += ' | '; - htmlVar += ' ' + doI18N("administration.link.add.role") + ''; + htmlVar += ' ' + doI18N("administration.link.add.role") + ''; htmlVar += ' | '; - htmlVar += ' ' + doI18N("administration.link.view.permissions") + ''; + htmlVar += ' ' + doI18N("administration.link.view.permissions") + ''; htmlVar += ''; htmlVar += '
'; htmlVar += '

'; @@ -502,26 +501,21 @@ function jsViewsRegisterHelpers() { $(this).remove(); }, open: function (event, ui) { -/* - if (roles) { - $('#add').click(function() { - return !$('#notSelectedPermissions option:selected').remove().appendTo('#permissions'); - }); - - $('#remove').click(function() { - return !$('#permissions option:selected').remove().appendTo('#notSelectedPermissions'); - }); - } else { - $('#add').click(function() { - return !$('#notSelectedRoles option:selected').remove().appendTo('#roles'); - }); - - $('#remove').click(function() { - return !$('#roles option:selected').remove().appendTo('#notSelectedRoles'); - }); - } -*/ + $('#addpermissions').click(function() { + return !$('#notSelectedPermissions option:selected').remove().appendTo('#permissions'); + }); + $('#removepermissions').click(function() { + return !$('#permissions option:selected').remove().appendTo('#notSelectedPermissions'); + }); + + $('#addroles').click(function() { + return !$('#notSelectedRoles option:selected').remove().appendTo('#roles'); + }); + $('#removeroles').click(function() { + return !$('#roles option:selected').remove().appendTo('#notSelectedRoles'); + }); + $('#add').click(function() { return !$('#notSelectedItems option:selected').remove().appendTo('#selectedItems'); }); @@ -1245,7 +1239,6 @@ function loadILLoan(loanId) { executeAjaxRequest('users', 'GET', "", successFunction, formErrorFunction); } - function maintainUser(getUrl, putOrPostUrl, submitType, dialogTitle) { var templateSelector = "#userFormTemplate"; @@ -1259,7 +1252,87 @@ function loadILLoan(loanId) { popupDialogWithFormView(getUrl, putOrPostUrl, submitType, dialogTitle, templateSelector, width, height, saveSuccessFunction); } + function refreshRolesView() { + + var successFunction = function(data, textStatus, jqXHR) { + + var rolesObject = new Object(); + rolesObject.roles = data; + var listHtml = $("#roleListTemplate").render(rolesObject); + $("#contentplaceholder").html(listHtml); + + $("a.edit").click( function(e) { + var linkId = this.id; + var entityId = linkId.replace("edit", ""); + var getUrl = 'roles/' + entityId + '?template=true'; + var putUrl = 'roles/' + entityId; + maintainRole(getUrl, putUrl, 'PUT', "dialog.title.edit.details"); + e.preventDefault(); + }); + + $("a.delete").click( function(e) { + //var linkId = this.id; + //var entityId = linkId.replace("delete", ""); + showNotAvailableDialog('dialog.title.functionality.not.available'); + e.preventDefault(); + }); + + var oTable = $("#entitytable").dataTable( { + "bSort": true, + "bInfo": true, + "bJQueryUI": true, + "bRetrieve": false, + "bScrollCollapse": false, + "bPaginate": false, + "bLengthChange": false, + "bFilter": false, + "bAutoWidth": false, + } ); + }; + + executeAjaxRequest('roles', 'GET', "", successFunction, formErrorFunction); + } + + function maintainRole(getUrl, putOrPostUrl, submitType, dialogTitle) { + var templateSelector = "#roleFormTemplate"; + var width = 1000; + var height = 550; + + var saveSuccessFunction = function(data, textStatus, jqXHR) { + $("#dialog-form").dialog("close"); + refreshRolesView(); + } + + popupDialogWithFormView(getUrl, putOrPostUrl, submitType, dialogTitle, templateSelector, width, height, saveSuccessFunction); + } + + + function refreshPermissionsView() { + var templateSelector = "#permissionListTemplate"; + var displayAreaDivSelector = "#contentplaceholder"; + + var successFunction = function(data, textStatus, jqXHR) { + var permissionsObject = new Object(); + permissionsObject.permissions = data; + var listHtml = $(templateSelector).render(permissionsObject); + $(displayAreaDivSelector).html(listHtml); + + var oTable = $("#entitytable").dataTable( { + "bSort": true, + "bInfo": true, + "bJQueryUI": true, + "bRetrieve": false, + "bScrollCollapse": false, + "bPaginate": false, + "bLengthChange": false, + "bFilter": false, + "bAutoWidth": false, + } ); + }; + + executeAjaxRequest('permissions', 'GET', "", successFunction, formErrorFunction); + }
{{=$ctx.doI18N("table.heading.rolename")}}{{=$ctx.doI18N("table.heading.description")}}  
{{=name}} {{=description}} - - + {{=$ctx.doI18N("link.action.product.viewedit")}} + {{=$ctx.doI18N("link.action.product.delete")}}