1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- var Unibase;
- (function (Unibase) {
- let Platform;
- (function (Platform) {
- let AppGroups;
- (function (AppGroups) {
- let Components;
- (function (Components) {
- class EditAppGroup extends Platform.Core.BaseComponent {
- constructor() {
- super();
- this._appGroupManager = AppGroups.Managers.AppGroupManager.Instance();
- }
- cssFiles() {
- return [];
- }
- jsFiles() {
- return ["platform/appgroups/requests/appgroup.js"];
- }
- html(id, containerid) {
- let html = `<form id="frm_Bizgaze_EditAppGroup" method="post" data-validate="parsley" class="w-f bg-white"><input type="hidden" id="AppGroupId" value="" /><div class="header b-b bg-white p-3" id="div_EditAppGroupHeader"><strong>Edit App Group</strong></div><div class="scrollable"><div id="Bizgaze_ErrorMessagesEditAppGroup" class="clear"></div><div class="card"><div class="card-body"><div class="row"><div class="col-sm-6"><div class="floating-label-form-group floating-label-form-group-with-value" id="div_AppGroupName"><label for="txt_RenameGroup" id="lbl_RenameGroup">App Group Name <span class="text-danger">*</span></label><input type="text" id="txt_RenameGroup" class="form-control value-control floating-label-control" data-isdynamic="false" placeholder="App Group Name *" data-placeholder="Enter Group Name" data-label="App Group Name *" value="" /></div></div><div class="col-sm-6"><div class="floating-label-form-group floating-label-form-group-with-value" id="div_Index"><label for="txt_DisplayIndex" id="lbl_DisplayIndex">Display Index</label><div class=""><input type="number" min="0" onkeypress="return event.charCode != 45 && event.charCode!=101" id="txt_DisplayIndex" class="form-control value-control floating-label-control" placeholder="Display Index" data-placeholder="Enter Display Index" data-label="Display Index" value="" /></div></div></div></div><br /><div class="panel panel-danger mt-3"><div class="panel-body text-center">You can delete this Group if you do not want this Group to exists for any users across all the portals<div class="clear text-center mt-2"><input onclick="Unibase.Platform.AppGroups.Components.EditAppGroup.Instance().deleteGroup();" type="button" id="DeleteGrp" value="Delete Group" class="btn btn-danger m-t-lg" /></div></div></div></div></div><div class="mt-30 hidden" id="GrpItemDiv"><div class="card"><div class="card-body"><p style="color:red"><em>* Before deleting the Group, Apps needs to be Un-grouped.</em></p></div><ul class="list-group list-group-flush" id="UlMoveGroup"></ul><div class="card-footer"><input type="button" style="width:auto" id="" value="Un-group all Apps & Delete" onclick="Unibase.Platform.AppGroups.Components.EditAppGroup.Instance().UnGroupAllandDelete()" class="btn btn-warning btn-sm" /><br /></div></div></div></div><div class="footer bg-white"><a href="javascript:;" id="btn_CloseAppGroup" class="btn btn-sm btn-light mr-auto">Close</a><a href="javascript:;" onclick="Unibase.Platform.AppGroups.Components.EditAppGroup.Instance().renameGroup();" id="RenameGrp" class="btn btn-sm btn-primary">Save</a></div></form>`;
- return html;
- }
- load(id, containerid, callback) {
- var instance = this;
- $("#div_EditAppGroupHeader").removeClass("pa-5");
- $("#btn_CloseAppGroup").click(function () {
- instance.navigationHelper.closePopUp();
- });
- instance._appGroupManager.getAppGroup(id).then(function (response) {
- var groupData = response.result;
- $("#AppGroupId").val(groupData.AppGroupId);
- $("#txt_RenameGroup").val(groupData.AppGroupName);
- $("#txt_DisplayIndex").val(groupData.DisplayIndex);
- });
- }
- deleteGroup() {
- var instance = this;
- var AppGroupId = Number($('#AppGroupId').val());
- instance._appGroupManager.getAppsByGroup(AppGroupId).then(function (response) {
- var Listhtml = "";
- for (var i = 0; i < response.result.length; i++) {
- Listhtml += '<li id="' + response.result[i].InstalledAppId + '" class="list-group-item">' + response.result[i].AppTitle + '</li>';
- }
- if (Listhtml != "") {
- $('#UlMoveGroup').html(Listhtml);
- $('#GrpItemDiv').removeClass('hidden');
- }
- var itmLength = $('#UlMoveGroup li').length;
- if (itmLength == 0) {
- instance._appGroupManager.deleteAppGroup(AppGroupId).then(function (response) {
- instance.navigationHelper.closePopUp();
- Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups();
- if (response.errors == null)
- MessageHelper.Instance().showSuccess('Group Deleted Successfully', '');
- else
- MessageHelper.Instance().showError(response.errors[0], "Bizgaze_AppGroupErrorMessages");
- });
- }
- });
- }
- UnGroupAllandDelete() {
- var instance = this;
- var ToDeleteGroupId = $('#AppGroupId').val();
- instance._appGroupManager.deleteAppGroup(ToDeleteGroupId).then(function (response) {
- instance.navigationHelper.closePopUp();
- Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups();
- if (response.errors == null)
- MessageHelper.Instance().showSuccess('Group Deleted Successfully', '');
- else
- MessageHelper.Instance().showError(response.errors[0], "Bizgaze_AppGroupErrorMessages");
- });
- }
- renameGroup() {
- var instance = this;
- var objreq = new Unibase.Platform.AppGroups.Requests.AppGroup();
- objreq.AppGroupId = Number($('#AppGroupId').val());
- objreq.DisplayIndex = Number($('#txt_DisplayIndex').val());
- objreq.AppGroupName = String($('#txt_RenameGroup').val());
- instance._appGroupManager.saveAppGroup(objreq).then(function (response) {
- if (response.errors == null) {
- MessageHelper.Instance().showSuccess('App Group Saved Successfully', '');
- instance.navigationHelper.closePopUp();
- Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups();
- }
- else
- MessageHelper.Instance().showError(response.errors[0], "Bizgaze_ErrorMessagesEditAppGroup");
- });
- }
- static Instance() {
- return new EditAppGroup();
- }
- }
- Components.EditAppGroup = EditAppGroup;
- })(Components = AppGroups.Components || (AppGroups.Components = {}));
- })(AppGroups = Platform.AppGroups || (Platform.AppGroups = {}));
- })(Platform = Unibase.Platform || (Unibase.Platform = {}));
- })(Unibase || (Unibase = {}));
|