123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Platform;
- (function (Platform) {
- let Automation;
- (function (Automation) {
- let Components;
- (function (Components) {
- class NotificationGroup extends Platform.Core.BaseComponent {
- cssFiles() {
- return [''];
- }
- jsFiles() {
- return ['platform/automation/managers/notificationgroupmanager.js', 'platform/automation/requests/notificationgroup.js'];
- }
- html(id, containerid) {
- let html = `<form id="frmUnibase_NotificationGroup" data-validate="parsley" data-isdynamic="false">
- <div id="Validate_NotificationGroup" class="clear"></div>
- <div class="card bg-light">
- <div class="b-b bg-white card-header header">
- <strong class="text-dark title" id="Form_NotificationGroup">Create NotificationGroup</strong>
- </div>
- <div class="card-body scrollable" style="overflow-y: scroll;">
- <div class="bg-white card" id="divNotificationGrp">
- <div id="unibase_ValidationSummary" class="clear"></div>
- <input type="hidden" class="hd_notificatiobgroupid" value="0">
- <div class="card-body">
- <div class="row">
- <div class="col-sm-6">
- <div class="floating-label-form-group">
- <span class="ml-2" id="lbl_notificationgrp">Group Name</span>
- <input type="text" id="txt_GrpName" class="form-control required value-control floating-label-control" data-isdynamic="false" placeholder="Group Name*" data-placeholder="Enter GroupName" data-label="GroupName Name*" />
- <input type="hidden" id="hf_Grpname_notification" />
- <label for="Validation" id="lblValidation_GrpNotification"></label>
- </div>
- </div>
- <div class="col-sm-6">
- <div class="floating-label-form-group">
- <span class="font-bold ml-2">Group Index</span><input type="text" id="txt_GrpIndex" class="form-control required value-control floating-label-control" data-isdynamic="false" placeholder="Group Index*" data-label="GroupIndex" />
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="bg-white card-footer footer" id="Notification_groupfooter">
- <button id="btnCloseGroup" class="btn btn-secondary btn-sm mr-auto">Close</button>
- <button id="btnSaveGroup" class="btn btn-primary btn-sm pull-right">Save</button>
- </div>
- </div>
- </form>`;
- return html;
- }
- load(id, containerid, callback) {
- $('#btnSaveGroup').click(function () {
- Unibase.Platform.Automation.Components.NotificationGroup.Instance().saveNotificationGroup(containerid);
- });
- $('#btnCloseGroup').click(function () {
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- });
- if (id == 0) {
- Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().GetCurrentIndex().then(function (response) {
- if (response.status == Unibase.Data.Status.Success) {
- $('#txt_GrpIndex').attr("disabled", "true").val(response.result);
- }
- });
- }
- else {
- Unibase.Platform.Automation.Components.NotificationGroup.Instance().EditNotificationGroup(id);
- }
- }
- init(recoderid, callback, isaction) {
- NotificationGroup.IsAction = isaction;
- this.navigationHelper.popup(recoderid, '', Unibase.Platform.Automation.Components.NotificationGroup.Instance(), callback, Platform.Helpers.Size.DockLeft);
- }
- loadNotificationsGroups(iscreate) {
- var Pk_Value = 0;
- if (!iscreate) {
- Pk_Value = Unibase.Themes.Providers.DetailHelper.recordId;
- }
- this.navigationHelper.popup(Pk_Value, '', Unibase.Platform.Automation.Components.NotificationGroup.Instance(), null, Platform.Helpers.Size.DockLeft);
- }
- loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
- Unibase.Platform.Automation.Components.NotificationGroup.Instance().init(Number(Pk_Value), null);
- }
- EditNotificationGroup(Id) {
- $('.hd_notificatiobgroupid').val(Id);
- $('#Form_NotificationGroup').text('Edit NotificationGroup');
- Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().GetNotificationGroupInfo(Id).then(function (response) {
- if (response != null) {
- NotificationGroup.GroupName = response.NotificationGroupName;
- $('#txt_GrpName').val(response.NotificationGroupName);
- $('#txt_GrpIndex').attr("disabled", "true").val(response.Index);
- }
- });
- }
- saveNotificationGroup(containerid) {
- var groupname = $('#txt_GrpName').val();
- if (groupname == undefined || groupname == null || groupname == '') {
- MessageHelper.Instance().showError('GroupName Is Mandatory', "Validate_NotificationGroup");
- return;
- }
- if (groupname == NotificationGroup.GroupName) {
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(Unibase.Platform.Automation.Components.RuleProvider.installedappid, null);
- return;
- }
- var object = new Unibase.Platform.Automation.Requests.NotificationGroup();
- object.NotificationGroupId = Number($('.hd_notificatiobgroupid').val());
- object.NotificationGroupName = groupname.toString();
- object.Index = Number($('#txt_GrpIndex').val());
- Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().saveNotificationGroup(object).then(function (response) {
- if (response.status == Unibase.Data.Status.Success) {
- MessageHelper.Instance().showSuccess(response.message, "Validate_NotificationGroup");
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- if (NotificationGroup.IsAction) {
- Unibase.Platform.Automation.Components.NotificationGroup.Instance().LoadNotificationGroups();
- }
- else {
- Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(Unibase.Platform.Automation.Components.RuleProvider.installedappid, null);
- }
- }
- else {
- MessageHelper.Instance().showError(response.message, "Validate_NotificationGroup");
- }
- });
- }
- LoadNotificationGroups() {
- return __awaiter(this, void 0, void 0, function* () {
- yield Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().GetNotificationGroups().then(function (response) {
- if (response != null) {
- var html = '<option value="0">Select GroupName</option>';
- for (let i = 0; i < response.length; i++) {
- html += '<option value=' + response[i].NotificationGroupId + '>' + response[i].NotificationGroupName + '</option>';
- }
- $('#ddl_NotificationGrp').html(html);
- }
- });
- });
- }
- static Instance() {
- if (this.instance == undefined) {
- this.instance = new NotificationGroup();
- }
- return this.instance;
- }
- }
- NotificationGroup.GroupName = null;
- NotificationGroup.IsAction = false;
- Components.NotificationGroup = NotificationGroup;
- })(Components = Automation.Components || (Automation.Components = {}));
- })(Automation = Platform.Automation || (Platform.Automation = {}));
- })(Platform = Unibase.Platform || (Unibase.Platform = {}));
- })(Unibase || (Unibase = {}));
|