Iniit
This commit is contained in:
@@ -0,0 +1,246 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Platform;
|
||||
(function (Platform) {
|
||||
let Permissions;
|
||||
(function (Permissions) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class EditRole extends Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.InstalledAppId = 0;
|
||||
}
|
||||
cssFiles() {
|
||||
return ['libs/jquery-ui-slider-pips/jquery-ui-slider-pips.css', 'libs/jquery-ui-slider-pips/Custom-slider-ui-pips.css'];
|
||||
}
|
||||
jsFiles() {
|
||||
return ['platform/permission/components/editrole.js', 'platform/permission/requests/role.js', '/platform/apps/components/stages/stages.js', 'platform/permission/components/permissions.js', '/platform/apps/managers/stagemanager.js', '/platform/apps/components/stages/stagepermissions.js', '/platform/filters/components/filter.js', '/platform/filters/managers/filtermanager.js', 'platform/permission/managers/permissionmanager.js', 'platform/permission/requests/approlesetting.js', '/platform/permission/infos/role.js', "platform/forms/components/formviewer/formviewer.js", 'libs/parsley/parsley.min.js', 'platform/permission/managers/permissionmanager.js', 'platform/core/infos/status.js'];
|
||||
}
|
||||
html(id, containerid) {
|
||||
var instance = this;
|
||||
var appid = instance.appSettings.InstalledAppId;
|
||||
instance.InstalledAppId = instance.appSettings.InstalledAppId;
|
||||
let html = ``;
|
||||
html += `<form id="form_Roles" default="" button="btnSaveDesignation" data-validate="parsley" data-isdynamic="false">
|
||||
<input type="hidden" id="hf_RoleId" value="" />
|
||||
<div class="b-b bg-white header">
|
||||
<strong class="text-dark Title" id="newRole">New Role</strong>
|
||||
<strong class="text-dark hidden Title" id="editRole">Edit Role</strong>
|
||||
<div class="btn-group ml-auto">
|
||||
<a class="btn btn-sm"><i class="ti-help-alt" title="help"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="simple-scroll-bar scrollable" id="divroleheight">
|
||||
<div class="clear" id="divRoleError">
|
||||
</div>
|
||||
<div class="card">
|
||||
<div id="div_rolemessage" class="clear"></div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="" id="div_rolename">
|
||||
<label for="lblName">Role Name<span class="text-danger"> *</span></label>
|
||||
|
||||
<input id="txtRoleName" class="form-control value-control required floating-label-control pl-1" data-isdefault="true" data-required="true" data-validatemsg data-val-required="The RoleName field is required." placeholder="RoleName" type="text" value="" data-label="Role Name *" data-placeholder="Administrator">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="" id="div_roleDescription">
|
||||
<label for="lblDescription">Description</label>
|
||||
|
||||
<input id="txtDescription" class="form-control value-control floating-label-control pl-1" name="Description" data-isdefault="true" data-required="true" data-regularexp data-validatemsg placeholder="Short description about the role" type="text" value="" data-label="Description" data-placeholder="Short description about the role">
|
||||
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<label for="lblLobCategory" class="mt-15">
|
||||
Is
|
||||
Public ?
|
||||
</label>
|
||||
<input type="hidden" id="hfIsPublic" value="false" />
|
||||
<div class="btn-group btn-group-justified mt-10" data-toggle="buttons">
|
||||
<label class="btn btn-sm btn-isPublic btn-default active" onclick="Unibase.Platform.Permissions.Components.EditRole.Instance().ispublicChange(false)">
|
||||
<input name="options" id="option2" type="radio">
|
||||
<i class="fa fa-check text-active"></i>No
|
||||
</label>
|
||||
<label class="btn btn-sm btn-default btn-isPublictrue " onclick=" Unibase.Platform.Permissions.Components.EditRole.Instance().ispublicChange(true)">
|
||||
<input name="options" id="option1" type="radio">
|
||||
<i class="fa fa-check text-active"></i> Yes
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="mt-15">Auto Assignment</label>
|
||||
<input type="hidden" id="hfAutoAssignment" value="false" />
|
||||
<div class="btn-group btn-group-justified mt-10" data-toggle="buttons">
|
||||
<label class="btn btn-sm btn-default btn-isAutoAssignment active" onclick=" Unibase.Platform.Permissions.Components.EditRole.Instance().isAutoAssignmentChange(false)">
|
||||
<input name="options" id="option2" type="radio">
|
||||
<i class="fa fa-check text-active"></i>No
|
||||
</label>
|
||||
<label class="btn btn-sm btn-default btn-isAutoAssignmentTrue " onclick=" Unibase.Platform.Permissions.Components.EditRole.Instance().isAutoAssignmentChange(true)">
|
||||
<input name="options" id="option1" type="radio">
|
||||
<i class="fa fa-check text-active"></i>Yes
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class=" floating-label-form-group floating-label-form-group-with-value" id="div_InternalRole">
|
||||
<label for="lblInternalRole">Internal Role <span class="text-danger"> *</span></label>
|
||||
<select id="select_InternalRole" class="form-control value-control required floating-label-control" placeholder="Select Internal Role" data-required="true"></select>
|
||||
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="bg-white footer b-t">
|
||||
<a href="javascript:;" id="btn_Close" class="btn btn-light btn-sm mr-auto btn-close">Close</a>
|
||||
<a href="javascript:;" id="btn_SaveRole" class="pull-right btn btn-sm btn-primary">Save</a>
|
||||
</div>
|
||||
</form>`;
|
||||
return html;
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
var roleid = id;
|
||||
var instance = this;
|
||||
instance.InstalledAppId = instance.appSettings.InstalledAppId;
|
||||
$("#btn_rolesClose").click(function () {
|
||||
$('#' + containerid).modal('hide');
|
||||
$('#' + containerid).remove();
|
||||
});
|
||||
$("#btn_SaveRole").click(function () {
|
||||
let rolecontrolid = "form_Roles";
|
||||
let result = Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation(rolecontrolid);
|
||||
if (result == false) {
|
||||
MessageHelper.Instance().showError("Mandatory fields are missing", "div_rolemessage");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
instance.SaveRole(containerid, roleid, instance.InstalledAppId);
|
||||
}
|
||||
});
|
||||
$('#btnAddNewStage_' + containerid).click(function () {
|
||||
Unibase.Platform.Apps.Components.Stages.Instance().AddStage(0);
|
||||
});
|
||||
$("#btn_Close").click(function () {
|
||||
$('#' + containerid).modal('hide');
|
||||
$('#' + containerid).remove();
|
||||
});
|
||||
instance.roledata(id);
|
||||
}
|
||||
roledata(roleid) {
|
||||
var instance = this;
|
||||
$("#divroleheight").height($(window).outerHeight() - 144);
|
||||
Permissions.Managers.PermissionManager.Instance().getInternalRoles().then(function (response) {
|
||||
for (var i = 0; i < response.result.length; i++) {
|
||||
$('#select_InternalRole').append('<option value="' + response.result[i].Value + '">' + response.result[i].SelectText + '</option>');
|
||||
}
|
||||
if (roleid != 0) {
|
||||
Unibase.Platform.Permissions.Managers.PermissionManager.Instance().getRole(roleid).then(function (response) {
|
||||
var role = response.result;
|
||||
var status1 = '';
|
||||
var status2 = '';
|
||||
if (role.IsPublic == true) {
|
||||
status1 = 'active';
|
||||
status2 = '';
|
||||
}
|
||||
else {
|
||||
status1 = '';
|
||||
status2 = 'active';
|
||||
}
|
||||
var assign1 = '';
|
||||
var assign2 = '';
|
||||
if (role.AutoAssignment == true) {
|
||||
assign1 = 'active';
|
||||
assign2 = '';
|
||||
}
|
||||
else {
|
||||
assign1 = '';
|
||||
assign2 = 'active';
|
||||
}
|
||||
$("#txtRoleName").val(role.RoleName);
|
||||
$("#txtDescription").val(role.Description);
|
||||
$("#hf_RoleId").val(role.RoleId);
|
||||
$(".btn-isPublic").removeClass('active').addClass(status2);
|
||||
$(".btn-isPublictrue").addClass(status1);
|
||||
$(".btn-isAutoAssignment").removeClass('active').addClass(assign2);
|
||||
$(".btn-isAutoAssignmentTrue").addClass(assign1);
|
||||
$("#editRole").removeClass('hidden');
|
||||
$("#newRole").addClass('hidden');
|
||||
$("#hfIsPublic").val(String(role.IsPublic));
|
||||
$("#hfAutoAssignment").val(String(role.AutoAssignment));
|
||||
$('#select_InternalRole').val(role.InternalRoleId);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
editRole(roleid, installedappid) {
|
||||
var appinstalledid = installedappid;
|
||||
var instance = Unibase.Platform.Permissions.Components.EditRole.Instance();
|
||||
instance.appSettings.InstalledAppId = Number(appinstalledid);
|
||||
this.navigationHelper.popup(roleid, '', instance, null, Platform.Helpers.Size.DockLeft);
|
||||
}
|
||||
ispublicChange(status) {
|
||||
$('#hfIsPublic').val(status);
|
||||
}
|
||||
isAutoAssignmentChange(status) {
|
||||
$('#hfAutoAssignment').val(status);
|
||||
}
|
||||
SaveRole(containerid, roleid, InstalledAppId) {
|
||||
if (roleid == 0) {
|
||||
$('#hf_RoleId').val(0);
|
||||
}
|
||||
if ($('#hfIsPublic').val() == '') {
|
||||
$('#hfIsPublic').val("false");
|
||||
}
|
||||
if ($('#hfAutoAssignment').val() == '') {
|
||||
$('#hfAutoAssignment').val("false");
|
||||
}
|
||||
if (Number($('#select_InternalRole').val()) == 0) {
|
||||
MessageHelper.Instance().showError("Please Select InternalRole", "divRoleError");
|
||||
return false;
|
||||
}
|
||||
let reqObj = new Permissions.Requests.Role();
|
||||
reqObj.RoleId = Number(roleid);
|
||||
reqObj.RoleName = String($('#txtRoleName').val());
|
||||
reqObj.Description = String($('#txtDescription').val());
|
||||
reqObj.IsPublic = Boolean($('#hfIsPublic').val());
|
||||
reqObj.AutoAssignment = Boolean($('#hfAutoAssignment').val());
|
||||
reqObj.InternalRoleId = Number($('#select_InternalRole').val());
|
||||
Permissions.Managers.PermissionManager.Instance().saveRole(reqObj).then(function (response) {
|
||||
if (response.status == Unibase.Data.Status.Error) {
|
||||
MessageHelper.Instance().showError(response.message, "divRoleError");
|
||||
}
|
||||
else {
|
||||
MessageHelper.Instance().showSuccess(response.message, "divRoleError");
|
||||
$('#' + containerid).modal('hide');
|
||||
$('#' + containerid).remove();
|
||||
}
|
||||
Unibase.Platform.Permissions.Components.Permission.Instance().loadRoles(InstalledAppId, "");
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
if (this.instance === undefined) {
|
||||
this.instance = new EditRole();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
Components.EditRole = EditRole;
|
||||
})(Components = Permissions.Components || (Permissions.Components = {}));
|
||||
})(Permissions = Platform.Permissions || (Platform.Permissions = {}));
|
||||
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
File diff suppressed because one or more lines are too long
+89
@@ -0,0 +1,89 @@
|
||||
var Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(r){class u extends t.Core.BaseComponent{constructor(){super();this.InstalledAppId=0}cssFiles(){return["libs/jquery-ui-slider-pips/jquery-ui-slider-pips.css","libs/jquery-ui-slider-pips/Custom-slider-ui-pips.css"]}jsFiles(){return["platform/permission/components/editrole.js","platform/permission/requests/role.js","/platform/apps/components/stages/stages.js","platform/permission/components/permissions.js","/platform/apps/managers/stagemanager.js","/platform/apps/components/stages/stagepermissions.js","/platform/filters/components/filter.js","/platform/filters/managers/filtermanager.js","platform/permission/managers/permissionmanager.js","platform/permission/requests/approlesetting.js","/platform/permission/infos/role.js","platform/forms/components/formviewer/formviewer.js","libs/parsley/parsley.min.js","platform/permission/managers/permissionmanager.js","platform/core/infos/status.js"]}html(){var n=this,i=n.appSettings.InstalledAppId;n.InstalledAppId=n.appSettings.InstalledAppId;let t=``;return t+`<form id="form_Roles" default="" button="btnSaveDesignation" data-validate="parsley" data-isdynamic="false">
|
||||
<input type="hidden" id="hf_RoleId" value="" />
|
||||
<div class="b-b bg-white header">
|
||||
<strong class="text-dark Title" id="newRole">New Role</strong>
|
||||
<strong class="text-dark hidden Title" id="editRole">Edit Role</strong>
|
||||
<div class="btn-group ml-auto">
|
||||
<a class="btn btn-sm"><i class="ti-help-alt" title="help"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="simple-scroll-bar scrollable" id="divroleheight">
|
||||
<div class="clear" id="divRoleError">
|
||||
</div>
|
||||
<div class="card">
|
||||
<div id="div_rolemessage" class="clear"></div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="" id="div_rolename">
|
||||
<label for="lblName">Role Name<span class="text-danger"> *</span></label>
|
||||
|
||||
<input id="txtRoleName" class="form-control value-control required floating-label-control pl-1" data-isdefault="true" data-required="true" data-validatemsg data-val-required="The RoleName field is required." placeholder="RoleName" type="text" value="" data-label="Role Name *" data-placeholder="Administrator">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="" id="div_roleDescription">
|
||||
<label for="lblDescription">Description</label>
|
||||
|
||||
<input id="txtDescription" class="form-control value-control floating-label-control pl-1" name="Description" data-isdefault="true" data-required="true" data-regularexp data-validatemsg placeholder="Short description about the role" type="text" value="" data-label="Description" data-placeholder="Short description about the role">
|
||||
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<label for="lblLobCategory" class="mt-15">
|
||||
Is
|
||||
Public ?
|
||||
</label>
|
||||
<input type="hidden" id="hfIsPublic" value="false" />
|
||||
<div class="btn-group btn-group-justified mt-10" data-toggle="buttons">
|
||||
<label class="btn btn-sm btn-isPublic btn-default active" onclick="Unibase.Platform.Permissions.Components.EditRole.Instance().ispublicChange(false)">
|
||||
<input name="options" id="option2" type="radio">
|
||||
<i class="fa fa-check text-active"></i>No
|
||||
</label>
|
||||
<label class="btn btn-sm btn-default btn-isPublictrue " onclick=" Unibase.Platform.Permissions.Components.EditRole.Instance().ispublicChange(true)">
|
||||
<input name="options" id="option1" type="radio">
|
||||
<i class="fa fa-check text-active"></i> Yes
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="mt-15">Auto Assignment</label>
|
||||
<input type="hidden" id="hfAutoAssignment" value="false" />
|
||||
<div class="btn-group btn-group-justified mt-10" data-toggle="buttons">
|
||||
<label class="btn btn-sm btn-default btn-isAutoAssignment active" onclick=" Unibase.Platform.Permissions.Components.EditRole.Instance().isAutoAssignmentChange(false)">
|
||||
<input name="options" id="option2" type="radio">
|
||||
<i class="fa fa-check text-active"></i>No
|
||||
</label>
|
||||
<label class="btn btn-sm btn-default btn-isAutoAssignmentTrue " onclick=" Unibase.Platform.Permissions.Components.EditRole.Instance().isAutoAssignmentChange(true)">
|
||||
<input name="options" id="option1" type="radio">
|
||||
<i class="fa fa-check text-active"></i>Yes
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class=" floating-label-form-group floating-label-form-group-with-value" id="div_InternalRole">
|
||||
<label for="lblInternalRole">Internal Role <span class="text-danger"> *</span></label>
|
||||
<select id="select_InternalRole" class="form-control value-control required floating-label-control" placeholder="Select Internal Role" data-required="true"></select>
|
||||
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="bg-white footer b-t">
|
||||
<a href="javascript:;" id="btn_Close" class="btn btn-light btn-sm mr-auto btn-close">Close</a>
|
||||
<a href="javascript:;" id="btn_SaveRole" class="pull-right btn btn-sm btn-primary">Save</a>
|
||||
</div>
|
||||
</form>`}load(t,i){var u=t,r=this;r.InstalledAppId=r.appSettings.InstalledAppId;$("#btn_rolesClose").click(function(){$("#"+i).modal("hide");$("#"+i).remove()});$("#btn_SaveRole").click(function(){let t=n.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation("form_Roles");if(t==!1)return MessageHelper.Instance().showError("Mandatory fields are missing","div_rolemessage"),!1;r.SaveRole(i,u,r.InstalledAppId)});$("#btnAddNewStage_"+i).click(function(){n.Platform.Apps.Components.Stages.Instance().AddStage(0)});$("#btn_Close").click(function(){$("#"+i).modal("hide");$("#"+i).remove()});r.roledata(t)}roledata(t){var r=this;$("#divroleheight").height($(window).outerHeight()-144);i.Managers.PermissionManager.Instance().getInternalRoles().then(function(i){for(var r=0;r<i.result.length;r++)$("#select_InternalRole").append('<option value="'+i.result[r].Value+'">'+i.result[r].SelectText+"<\/option>");t!=0&&n.Platform.Permissions.Managers.PermissionManager.Instance().getRole(t).then(function(n){var t=n.result,u="",f="",i,r;t.IsPublic==!0?(u="active",f=""):(u="",f="active");i="";r="";t.AutoAssignment==!0?(i="active",r=""):(i="",r="active");$("#txtRoleName").val(t.RoleName);$("#txtDescription").val(t.Description);$("#hf_RoleId").val(t.RoleId);$(".btn-isPublic").removeClass("active").addClass(f);$(".btn-isPublictrue").addClass(u);$(".btn-isAutoAssignment").removeClass("active").addClass(r);$(".btn-isAutoAssignmentTrue").addClass(i);$("#editRole").removeClass("hidden");$("#newRole").addClass("hidden");$("#hfIsPublic").val(String(t.IsPublic));$("#hfAutoAssignment").val(String(t.AutoAssignment));$("#select_InternalRole").val(t.InternalRoleId)})})}editRole(i,r){var f=r,u=n.Platform.Permissions.Components.EditRole.Instance();u.appSettings.InstalledAppId=Number(f);this.navigationHelper.popup(i,"",u,null,t.Helpers.Size.DockLeft)}ispublicChange(n){$("#hfIsPublic").val(n)}isAutoAssignmentChange(n){$("#hfAutoAssignment").val(n)}SaveRole(t,r,u){if(r==0&&$("#hf_RoleId").val(0),$("#hfIsPublic").val()==""&&$("#hfIsPublic").val("false"),$("#hfAutoAssignment").val()==""&&$("#hfAutoAssignment").val("false"),Number($("#select_InternalRole").val())==0)return MessageHelper.Instance().showError("Please Select InternalRole","divRoleError"),!1;let f=new i.Requests.Role;f.RoleId=Number(r);f.RoleName=String($("#txtRoleName").val());f.Description=String($("#txtDescription").val());f.IsPublic=Boolean($("#hfIsPublic").val());f.AutoAssignment=Boolean($("#hfAutoAssignment").val());f.InternalRoleId=Number($("#select_InternalRole").val());i.Managers.PermissionManager.Instance().saveRole(f).then(function(i){i.status==n.Data.Status.Error?MessageHelper.Instance().showError(i.message,"divRoleError"):(MessageHelper.Instance().showSuccess(i.message,"divRoleError"),$("#"+t).modal("hide"),$("#"+t).remove());n.Platform.Permissions.Components.Permission.Instance().loadRoles(u,"")})}static Instance(){return this.instance===undefined&&(this.instance=new u),this.instance}}r.EditRole=u})(r=i.Components||(i.Components={}))})(i=t.Permissions||(t.Permissions={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));
|
||||
@@ -0,0 +1,419 @@
|
||||
var Unibase;
|
||||
(function (Unibase) {
|
||||
let Platform;
|
||||
(function (Platform) {
|
||||
let Permissions;
|
||||
(function (Permissions) {
|
||||
let Components;
|
||||
(function (Components) {
|
||||
class Permission extends Platform.Core.BaseComponent {
|
||||
constructor() {
|
||||
super();
|
||||
this.InstalledAppId = 0;
|
||||
this.appmanager = Platform.Apps.Managers.AppManager.Instance();
|
||||
this.ipermissionmanager = Permissions.Managers.PermissionManager.Instance();
|
||||
}
|
||||
cssFiles() {
|
||||
return ['libs/jquery-ui-slider-pips/jquery-ui-slider-pips.css', 'libs/jquery-ui-slider-pips/Custom-slider-ui-pips.css'];
|
||||
}
|
||||
jsFiles() {
|
||||
return ['libs/jquery-ui-slider-pips/jquery-ui-slider-pips.js', '/platform/apps/managers/interfaces/iappmanager.js', '/platform/apps/managers/appmanager.js', '/platform/apps/components/stages/stages.js', '/platform/apps/managers/stagemanager.js', '/platform/apps/components/stages/stagepermissions.js', 'platform/permission/managers/permissionmanager.js', 'platform/permission/requests/approlesetting.js', '/platform/permission/infos/role.js', '/platform/datasources/managers/interfaces/idoctypemanager.js', '/platform/datasources/managers/doctypemanager.js', '/platform/apps/components/actionproviders/docpropertyactionprovider.js', 'platform/permission/components/editrole.js', 'platform/apps/components/stages/defaultstageroles.js'];
|
||||
}
|
||||
html(id, containerid) {
|
||||
var instance = this;
|
||||
var appid = instance.appSettings.InstalledAppId;
|
||||
instance.InstalledAppId = instance.appSettings.InstalledAppId;
|
||||
let html = `<header class="bg-white shadow-bottom modal-header" style="padding:0px !important" id="roleSettingHeader">
|
||||
<div class="container-fluid">
|
||||
<a title="AddRole" id="btnAddNewRole" class=" btnRole_` + containerid + ` pull-right btn btn-icon btn-flush-nav btn-rounded mt-5" href="javascript:;"><span class="btn-icon-wrap"><i class="fa fa-plus"></i></span></a>
|
||||
<a title="Default Stage Roles" id="btnDefaultStageRoles_` + containerid + `" class="pull-right btnDefaultStageRoles_` + containerid + ` hidden btn btn-icon btn-flush-nav btn-rounded mt-5 font-10" href="javascript:;"><span class="btn-icon-wrap"><i class="ti-key"></i></span></a>
|
||||
<a title="Add Stage" id="btnAddNewStage_` + containerid + `" class="pull-right btnstage_` + containerid + ` hidden btn btn-icon btn-flush-nav btn-rounded mt-5" href="javascript:;"><span class="btn-icon-wrap"><i class="fa fa-plus"></i></span></a>
|
||||
<a href="javascript:;" title="Add ActionProvider" id="btnAddAP_` + containerid + `" class=" pull-right btnAddAP_` + containerid + ` hidden btn btn-icon btn-flush-nav btn-rounded mt-5"><span class="btn-icon-wrap"><i class="fa fa-plus"></i></span></a>
|
||||
|
||||
<a title="Add WorkFlow" id="btnAddNewWorkFlow" class="pull-right btnWorkFlow hidden btn btn-icon btn-flush-nav btn-rounded mt-5"><span class="btn-icon-wrap"><i class="fa fa-plus"></i></span></a>
|
||||
|
||||
<ul class="nav nav-light nav-tabs layout-detail-tabs nav-line" role="tablist" id="masterTab">
|
||||
<li class="nav-item tab-item tab-pane tab-addeditem"><a href="javascript:;" id="tbRoles_` + containerid + `" onclick=" Unibase.Platform.Permissions.Components.Permission.Instance().loadRoles(` + instance.InstalledAppId + `);" class="d-flex h-50p align-items-center nav-link text-dark font-weight-600 active"><span class="portletName">Roles</span></a></li>
|
||||
<li class="nav-item tab-item tab-pane tab-addeditem hidden li_stages"><a href="javascript:;" id="tbStage_` + containerid + `" onclick="Unibase.Platform.Apps.Components.Stages.Instance().loadStages('` + containerid + `',` + appid + `);" class="d-flex h-50p align-items-center nav-link text-dark font-weight-600 "><span class="portletName">Stages</span></a></li>
|
||||
<li class="nav-item tab-item tab-pane tab-addeditem"><a href="javascript:;" id="tbProviders_` + containerid + `" onclick="Unibase.Platform.Apps.Components.DocPropertyActionProvider.Instance().loadActionProviders('` + containerid + `',` + appid + `);" class="d-flex h-50p align-items-center nav-link text-dark font-weight-600 "><span class="portletName">Action Providers</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<section data-simplebar class="simple-scroll-bar scrollable">
|
||||
<div class="clear" id="message">
|
||||
</div>
|
||||
<div class="tab-content row mt-n" id="tabs">
|
||||
<div class="tab-pane col-sm-12 active" id="roles">
|
||||
|
||||
<div id="div_Roles" class="card">
|
||||
<input type="hidden" id="hf_RoleId" value="" />
|
||||
<input type="hidden" id="hf_StageId" value="" />
|
||||
<div class="card-header">
|
||||
<input class="form-control rounded-input txt_rolesearch pull-right mt-5" id="RoleSearch" type="text" placeholder="Search" aria-label="Search" autocomplete="off" style="display:inline;height:30px">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="rolelist-div text-body" id="div_errormessage">
|
||||
</div>
|
||||
<div class="" id="CreateStageDiv"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tab-pane col-sm-12" id="stage_` + containerid + `">
|
||||
<div id="div_Stages" class="card"><div class="card-body div_stages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane col-sm-12" id="ActionProviders_` + containerid + `">
|
||||
<div id="div_ActionProviders" class="card"><div class="card-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="bg-white footer ft_permissions">
|
||||
<a href="javascript:;" id="btn_rolesClose_` + containerid + `" class="btn btn-light btn-sm mr-auto btn-close">Close</a>
|
||||
</footer>`;
|
||||
return html;
|
||||
}
|
||||
load(id, containerid, callback) {
|
||||
var instance = this;
|
||||
var appid = instance.appSettings.InstalledAppId;
|
||||
instance.InstalledAppId = instance.appSettings.InstalledAppId;
|
||||
instance.appmanager.getInstallApp(appid).then(function (appresponse) {
|
||||
if (appresponse.result.EnableStage) {
|
||||
$(".li_stages").removeClass('hidden');
|
||||
}
|
||||
});
|
||||
$("#tbRoles_" + containerid).click(function () {
|
||||
$(".tab-addeditem").find(".nav-link").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$("#tabs").find(".tab-pane").removeClass("active");
|
||||
$("#roles").addClass('active');
|
||||
$(".btnFilter_" + containerid).addClass('hidden');
|
||||
$(".btnstage_" + containerid).addClass('hidden');
|
||||
$(".btnRole_" + containerid).removeClass('hidden');
|
||||
$(".btnWorkFlow").addClass('hidden');
|
||||
$(".btnAddAP_" + containerid).addClass('hidden');
|
||||
$('#btnDefaultStageRoles_' + containerid + '').addClass('hidden');
|
||||
});
|
||||
$("#tbStage_" + containerid).click(function () {
|
||||
$(".tab-addeditem").find(".nav-link").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$("#tabs").find(".tab-pane").removeClass("active");
|
||||
$("#stage_" + containerid).addClass('active');
|
||||
$(".btnRole_" + containerid).addClass('hidden');
|
||||
$(".btnFilter_" + containerid).addClass('hidden');
|
||||
$(".btnstage_" + containerid).removeClass('hidden');
|
||||
$(".btnWorkFlow").addClass('hidden');
|
||||
$(".btnAddAP_" + containerid).addClass('hidden');
|
||||
$('#btnDefaultStageRoles_' + containerid + '').removeClass('hidden');
|
||||
});
|
||||
$("#tbProviders_" + containerid).click(function () {
|
||||
$(".tab-addeditem").find(".nav-link").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$("#tabs").find(".tab-pane").removeClass("active");
|
||||
$("#ActionProviders_" + containerid).addClass('active');
|
||||
$(".btnRole_" + containerid).addClass('hidden');
|
||||
$(".btnstage_" + containerid).addClass('hidden');
|
||||
$(".btnAddAP_" + containerid).removeClass('hidden');
|
||||
$(".btnWorkFlow").addClass('hidden');
|
||||
$('#btnDefaultStageRoles_' + containerid + '').addClass('hidden');
|
||||
});
|
||||
$('#btnAddNewRole').click(function () {
|
||||
Unibase.Platform.Permissions.Components.EditRole.Instance().editRole(id, appid);
|
||||
});
|
||||
$('#btnAddNewStage_' + containerid).click(function () {
|
||||
Unibase.Platform.Apps.Components.Stages.Instance().AddStage(0);
|
||||
});
|
||||
$('#btnAddAP_' + containerid).click(function () {
|
||||
Unibase.Platform.Apps.Components.DocPropertyActionProvider.Instance().AddActionProvider(0);
|
||||
});
|
||||
$('#btnDefaultStageRoles_' + containerid + '').click(function () {
|
||||
Unibase.Platform.Apps.Components.DefaultStageRoles.Instance().init(appid);
|
||||
});
|
||||
$(".txt_rolesearch").on('input', function () {
|
||||
var term = $(".txt_rolesearch").val();
|
||||
instance.loadRoles(appid, term);
|
||||
});
|
||||
instance.loadRoles(appid, "");
|
||||
}
|
||||
init() {
|
||||
var instance = this;
|
||||
this.navigationHelper.popup(0, '', instance, null, Platform.Helpers.Size.Large);
|
||||
instance.loadRoles(0, "");
|
||||
}
|
||||
loadPermissions(roleid, Isrole, IsStage, installedappid) {
|
||||
var instance = this;
|
||||
var roleId = Number(roleid);
|
||||
$("#hf_RoleId").val(roleId);
|
||||
if (Isrole == true) {
|
||||
var collapsed = $("#panelId-" + roleId).hasClass('collapse');
|
||||
if (!collapsed) {
|
||||
$("#panelId-" + roleId).addClass('collapse');
|
||||
$(".roleid-" + roleId).find(".fa-chevron-down").removeClass('d-none');
|
||||
$(".roleid-" + roleId).find(".fa-chevron-up").addClass('d-none');
|
||||
}
|
||||
else {
|
||||
$(".roleid-" + roleId).find(".fa-chevron-up").removeClass('d-none');
|
||||
$(".roleid-" + roleId).find(".fa-chevron-down").addClass('d-none');
|
||||
$("#panelId-" + roleId).removeClass('collapse');
|
||||
$(".roleid-" + roleId).find(".sliderDetails").remove();
|
||||
}
|
||||
}
|
||||
var installedPageId = installedappid;
|
||||
if (installedPageId == undefined) {
|
||||
installedPageId = 0;
|
||||
}
|
||||
instance.ipermissionmanager.getRoleSettings(roleId, Number(installedPageId), IsStage).then(function (response) {
|
||||
var SId = 0;
|
||||
var records = response.result;
|
||||
for (var i = 0; i < records.length; i++) {
|
||||
var ApplicableValue = [];
|
||||
var ApplicableLabels = [];
|
||||
var ApplicableText = ["None", "Owner", "Manager", "Admin", "Allow"];
|
||||
var ApplicableValues = records[i].ApplicableValuesList;
|
||||
var settingVal = records[i].SettingValue;
|
||||
for (var j = 0; j < ApplicableValues.length; j++) {
|
||||
var PermissionLevel = "";
|
||||
var pv = ApplicableValues[j];
|
||||
var permissionValue = pv.toString();
|
||||
switch (permissionValue) {
|
||||
case "0":
|
||||
PermissionLevel = "None";
|
||||
break;
|
||||
case "1":
|
||||
PermissionLevel = "None";
|
||||
break;
|
||||
case "2":
|
||||
PermissionLevel = "Owner";
|
||||
break;
|
||||
case "3":
|
||||
PermissionLevel = "Manager";
|
||||
break;
|
||||
case "4":
|
||||
PermissionLevel = "Admin";
|
||||
break;
|
||||
case "5":
|
||||
PermissionLevel = "Allow";
|
||||
break;
|
||||
}
|
||||
ApplicableValue.push(PermissionLevel);
|
||||
ApplicableLabels.push('<span>' + PermissionLevel + '</span>');
|
||||
}
|
||||
var SettingName = records[i].SettingName;
|
||||
var SystemName = records[i].SystemName;
|
||||
var apppermissionId = records[i].AppPermissionId;
|
||||
var html = "";
|
||||
if (records[i].StageId == 0) {
|
||||
var Isrole = false;
|
||||
var IsStage = true;
|
||||
html += "<div class='sliderDetails py-15'><div class='row'>" +
|
||||
" <div class='col-sm-4'>" +
|
||||
"<b>" + SettingName + "</b>" +
|
||||
"</div>";
|
||||
html += "<div class='col-sm-8 slider-container'>" +
|
||||
"<div class='block alert alert-primary mb-5 hidden'><label id='stages" + roleId + SystemName + "' class='lblAllStages hidden'>Applicable to all stages? <input type='checkbox' id='chk_AllStages_" + roleId + SystemName + "' checked onclick='Unibase.Platform.Permissions.Components.Permission.Instance().change(\"" + SystemName + "\",\"" + roleId + "\",\"" + Isrole + "\",\"" + IsStage + "\",\"" + i + "\"," + Number(installedPageId) + ");' value='' /></label></div>" +
|
||||
"<input type='hidden' class='applicablevalue' value='" + ApplicableValue.length + "' /><input type='hidden' class='appId' value='" + apppermissionId + "' /><input type='hidden' class='dd' value='" + i + "' /> <input type='hidden' id='hf_SystemName_1_' class='systemname' value='" + SystemName + "' /><div id='slider_" + i + SystemName + roleId + "' class='col-sm-12 double-label-slider' style='height:8px'></div>" +
|
||||
"</div>" +
|
||||
"</div><div class='bg-purple-light-5' style='display:none;' id='div_stage_settings_" + roleId + SystemName + "_container'><div class='pt-5 pb-5' id='div_stage_settings_" + roleId + SystemName + "'></div></div></div>";
|
||||
if (ApplicableValue.length < 2) {
|
||||
var status1 = "";
|
||||
var status2 = "";
|
||||
if (settingVal == 5) {
|
||||
status2 = 'checked';
|
||||
status1 = '';
|
||||
}
|
||||
else {
|
||||
status2 = '';
|
||||
status1 = 'checked';
|
||||
}
|
||||
if (settingVal == 5) {
|
||||
$(".option1" + roleId + SettingName).removeAttr("checked");
|
||||
$(".option2" + roleId + SettingName).prop("checked", true);
|
||||
}
|
||||
}
|
||||
$(".roleid-" + roleId).find(".sliderdiv").append(html);
|
||||
if (records[i].StagesList == 0) {
|
||||
$("#stages" + roleId + SystemName).addClass('hidden');
|
||||
}
|
||||
$(".roleid-" + roleId).find("#slider_" + i + SystemName + roleId)
|
||||
.slider({
|
||||
max: ApplicableValue.length - 1,
|
||||
min: 0,
|
||||
value: settingVal - 1,
|
||||
animate: 250
|
||||
})
|
||||
.slider("pips", {
|
||||
rest: "label",
|
||||
labels: ApplicableLabels
|
||||
});
|
||||
$(".roleid-" + roleId).find("#slider_" + i + SystemName + roleId).on("slidestop", function (event, ui) {
|
||||
var SettingValue = 0;
|
||||
var systemName = $(this).parents(".slider-container").find('.systemname').val();
|
||||
var approleId = $(this).parents(".slider-container").find('.appId').val();
|
||||
var applicablevalue = $(this).parents(".slider-container").find('.applicablevalue').val();
|
||||
if (applicablevalue == 2) {
|
||||
if (ui.value == 0) {
|
||||
SettingValue = ui.value + 1;
|
||||
}
|
||||
else {
|
||||
SettingValue = ui.value + 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SettingValue = ui.value + 1;
|
||||
}
|
||||
instance.changeAppRoleSetting(SettingValue, systemName, roleId, SId, approleId, installedappid);
|
||||
});
|
||||
}
|
||||
else {
|
||||
var SettingName = records[i].StageName;
|
||||
var SId = Number(records[i].StageId);
|
||||
var html2 = "<div class='ma-20 mr-25' id='div_stage_settings_" + roleId + SId + SystemName + "'><div class='sliderDetails row'>" +
|
||||
" <div class='col-sm-4'>" +
|
||||
"<b>" + SettingName + "</b>" +
|
||||
"</div>" +
|
||||
"<div class='col-sm-8 slider-container'><input type='hidden' class='sid' value='" + SId + "' /><input type='hidden' class='systemname' value='" + SystemName + "' /><div id='slider" + i + "' class='col-sm-12 double-label-slider' style='height:8px'></div></div></div></div>";
|
||||
if ($("#div_stage_settings_" + roleId + SystemName).find("#div_stage_settings_" + roleId + SId + SystemName).length == 0) {
|
||||
$("#div_stage_settings_" + roleId + SystemName).append(html2);
|
||||
}
|
||||
$("#div_stage_settings_" + roleId + SId + SystemName).find("#slider" + i)
|
||||
.slider({
|
||||
max: ApplicableValue.length - 1,
|
||||
min: 0,
|
||||
value: settingVal - 1,
|
||||
animate: 250
|
||||
})
|
||||
.slider("pips", {
|
||||
rest: "label",
|
||||
labels: ApplicableLabels
|
||||
});
|
||||
$("#div_stage_settings_" + roleId + SId + SystemName).find("#slider" + i).on("slidestop", function (event, ui) {
|
||||
var SettingValue = 0;
|
||||
var systemName = $(this).parents(".slider-container").find('.systemname').val();
|
||||
var sid = $(this).parents(".slider-container").find('.sid').val();
|
||||
var applicablevalue = $(this).parents(".slider-container").find('.applicablevalue').val();
|
||||
if (applicablevalue == 2) {
|
||||
if (ui.value == 0) {
|
||||
SettingValue = ui.value + 1;
|
||||
}
|
||||
else {
|
||||
SettingValue = ui.value + 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SettingValue = ui.value + 1;
|
||||
}
|
||||
instance.changeAppRoleSetting(SettingValue, systemName, roleId, sid, apppermissionId, installedappid);
|
||||
});
|
||||
var k = "#div_stage_settings_" + roleId + SystemName;
|
||||
var u = k + " .ui-slider-handle";
|
||||
var v = k + " .ui-slider-line";
|
||||
$(u).css("background-color", "#ab26aa");
|
||||
$(u).addClass("childSlider");
|
||||
$(v).css("box-shadow", "0 0 0 2px #ab26aa");
|
||||
}
|
||||
}
|
||||
$("#div_New_" + roleId + SystemName).show();
|
||||
});
|
||||
}
|
||||
statehover() {
|
||||
$(".type_last").addClass('state_hover');
|
||||
}
|
||||
change(SystemName, roleId, Isrole, IsStage, i, installedappid) {
|
||||
var instance = this;
|
||||
if ($("#chk_AllStages_" + roleId + SystemName).is(':checked')) {
|
||||
$("#div_stage_settings_" + roleId + SystemName + "_container").hide();
|
||||
$("#slider_" + i + SystemName + roleId).removeClass('hidden');
|
||||
}
|
||||
else {
|
||||
$("#div_stage_settings_" + roleId + SystemName + "_container").show();
|
||||
$("#div_stage_settings_" + roleId + SystemName).empty();
|
||||
instance.loadPermissions(roleId, Isrole, IsStage, installedappid);
|
||||
}
|
||||
}
|
||||
loadRoles(installedappid, term) {
|
||||
var instance = this;
|
||||
$(".Role-panel").each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
instance.ipermissionmanager.getRoles(term).then(function (response) {
|
||||
var data = response.result;
|
||||
if (data.length > 0) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var roleId = data[i].RoleId;
|
||||
var roleName = data[i].RoleName;
|
||||
var description = data[i].Description;
|
||||
var IsAdminRole = data[i].IsAdminRole;
|
||||
var link = "";
|
||||
var admininstruction = "";
|
||||
var Isrole = true;
|
||||
var IsStage = false;
|
||||
var SystemName = null;
|
||||
if (IsAdminRole != true) {
|
||||
link = "Unibase.Platform.Permissions.Components.Permission.Instance().loadPermissions(" + roleId + "," + Isrole + ", " + IsStage + "," + installedappid + ")";
|
||||
}
|
||||
else {
|
||||
admininstruction = " - This is admin default role can't access";
|
||||
}
|
||||
var html = "<section class='no-border Role-panel clearfix roleid-" + roleId + "' >" +
|
||||
"<header class='panel-heading border-bottom border-secondary roleHeader'>" +
|
||||
"<div class='row align-items-center'><a class='list-group col-sm-11 col-10' href='javascript:;' onclick='" + link + "' class='panel-toggle text-muted sliderdiv2'><div class='text-body d-flex align-items-center mt-10 mb-10 biz-highlight-bg-color'><span class='font-bold ml-10 col-sm-10'>" + roleName + admininstruction + "</span>" +
|
||||
"<span class='btn pull-right col-sm-1 col-1 p-0'><i class='fa fa-chevron-up d-none pull-right biz-highlight-bg-color'></i><i class='fa fa-chevron-down pull-right'></i></span></div></a>";
|
||||
if (IsAdminRole != true) {
|
||||
html += "<span class='col-2 col-sm-1'><a onclick='Unibase.Platform.Permissions.Components.EditRole.Instance().editRole(" + roleId + ", " + installedappid + ");' class='btn pull-right col-sm-1'><i class='fa fa-pencil pull-right biz-highlight-bg-color'></i></a></span>";
|
||||
}
|
||||
html += "</div></header>" +
|
||||
"<div id='panelId-" + roleId + "' class='panel-body bg-white collapse container'>" +
|
||||
"<div class='sliderdiv mr-10'>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</section>";
|
||||
var info = $('.rolelist-div').find(".roleid-" + roleId + "");
|
||||
if (IsAdminRole == true) {
|
||||
if (info.length == 0) {
|
||||
$('.rolelist-div').prepend(html);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (info.length == 0) {
|
||||
$('.rolelist-div').append(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
});
|
||||
}
|
||||
changeAppRoleSetting(settingValue, settingName, roleId, SId, approleSettingId, appinstalledid) {
|
||||
var instance = this;
|
||||
var InstalledAppId = appinstalledid;
|
||||
if (InstalledAppId == undefined) {
|
||||
InstalledAppId = 0;
|
||||
}
|
||||
let reqObj = new Unibase.Platform.Permissions.Requests.AppPermission();
|
||||
reqObj.StageId = Number(SId);
|
||||
reqObj.RoleId = Number(roleId);
|
||||
reqObj.SettingValue = settingValue;
|
||||
reqObj.SettingName = settingName;
|
||||
reqObj.InstalledAppId = Number(InstalledAppId);
|
||||
reqObj.AppPermissionId = Number(approleSettingId);
|
||||
instance.ipermissionmanager.saveRoleSetting(reqObj).then(function (response) {
|
||||
if (response.status == Unibase.Data.Status.Error) {
|
||||
MessageHelper.Instance().showError(response.message, "div_errormessage");
|
||||
}
|
||||
else {
|
||||
MessageHelper.Instance().showSuccess(response.message, "div_errormessage");
|
||||
}
|
||||
});
|
||||
}
|
||||
static Instance() {
|
||||
return new Permission();
|
||||
}
|
||||
}
|
||||
Components.Permission = Permission;
|
||||
})(Components = Permissions.Components || (Permissions.Components = {}));
|
||||
})(Permissions = Platform.Permissions || (Platform.Permissions = {}));
|
||||
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
|
||||
})(Unibase || (Unibase = {}));
|
||||
File diff suppressed because one or more lines are too long
+51
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user