Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notificationgroup.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Unibase;
  11. (function (Unibase) {
  12. let Platform;
  13. (function (Platform) {
  14. let Automation;
  15. (function (Automation) {
  16. let Components;
  17. (function (Components) {
  18. class NotificationGroup extends Platform.Core.BaseComponent {
  19. cssFiles() {
  20. return [''];
  21. }
  22. jsFiles() {
  23. return ['platform/automation/managers/notificationgroupmanager.js', 'platform/automation/requests/notificationgroup.js'];
  24. }
  25. html(id, containerid) {
  26. let html = `<form id="frmUnibase_NotificationGroup" data-validate="parsley" data-isdynamic="false">
  27. <div id="Validate_NotificationGroup" class="clear"></div>
  28. <div class="card bg-light">
  29. <div class="b-b bg-white card-header header">
  30. <strong class="text-dark title" id="Form_NotificationGroup">Create NotificationGroup</strong>
  31. </div>
  32. <div class="card-body scrollable" style="overflow-y: scroll;">
  33. <div class="bg-white card" id="divNotificationGrp">
  34. <div id="unibase_ValidationSummary" class="clear"></div>
  35. <input type="hidden" class="hd_notificatiobgroupid" value="0">
  36. <div class="card-body">
  37. <div class="row">
  38. <div class="col-sm-6">
  39. <div class="floating-label-form-group">
  40. <span class="ml-2" id="lbl_notificationgrp">Group Name</span>
  41. <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*" />
  42. <input type="hidden" id="hf_Grpname_notification" />
  43. <label for="Validation" id="lblValidation_GrpNotification"></label>
  44. </div>
  45. </div>
  46. <div class="col-sm-6">
  47. <div class="floating-label-form-group">
  48. <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" />
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="bg-white card-footer footer" id="Notification_groupfooter">
  56. <button id="btnCloseGroup" class="btn btn-secondary btn-sm mr-auto">Close</button>
  57. <button id="btnSaveGroup" class="btn btn-primary btn-sm pull-right">Save</button>
  58. </div>
  59. </div>
  60. </form>`;
  61. return html;
  62. }
  63. load(id, containerid, callback) {
  64. $('#btnSaveGroup').click(function () {
  65. Unibase.Platform.Automation.Components.NotificationGroup.Instance().saveNotificationGroup(containerid);
  66. });
  67. $('#btnCloseGroup').click(function () {
  68. $('#' + containerid).modal('hide');
  69. $('#' + containerid).remove();
  70. });
  71. if (id == 0) {
  72. Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().GetCurrentIndex().then(function (response) {
  73. if (response.status == Unibase.Data.Status.Success) {
  74. $('#txt_GrpIndex').attr("disabled", "true").val(response.result);
  75. }
  76. });
  77. }
  78. else {
  79. Unibase.Platform.Automation.Components.NotificationGroup.Instance().EditNotificationGroup(id);
  80. }
  81. }
  82. init(recoderid, callback, isaction) {
  83. NotificationGroup.IsAction = isaction;
  84. this.navigationHelper.popup(recoderid, '', Unibase.Platform.Automation.Components.NotificationGroup.Instance(), callback, Platform.Helpers.Size.DockLeft);
  85. }
  86. loadNotificationsGroups(iscreate) {
  87. var Pk_Value = 0;
  88. if (!iscreate) {
  89. Pk_Value = Unibase.Themes.Providers.DetailHelper.recordId;
  90. }
  91. this.navigationHelper.popup(Pk_Value, '', Unibase.Platform.Automation.Components.NotificationGroup.Instance(), null, Platform.Helpers.Size.DockLeft);
  92. }
  93. loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
  94. Unibase.Platform.Automation.Components.NotificationGroup.Instance().init(Number(Pk_Value), null);
  95. }
  96. EditNotificationGroup(Id) {
  97. $('.hd_notificatiobgroupid').val(Id);
  98. $('#Form_NotificationGroup').text('Edit NotificationGroup');
  99. Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().GetNotificationGroupInfo(Id).then(function (response) {
  100. if (response != null) {
  101. NotificationGroup.GroupName = response.NotificationGroupName;
  102. $('#txt_GrpName').val(response.NotificationGroupName);
  103. $('#txt_GrpIndex').attr("disabled", "true").val(response.Index);
  104. }
  105. });
  106. }
  107. saveNotificationGroup(containerid) {
  108. var groupname = $('#txt_GrpName').val();
  109. if (groupname == undefined || groupname == null || groupname == '') {
  110. MessageHelper.Instance().showError('GroupName Is Mandatory', "Validate_NotificationGroup");
  111. return;
  112. }
  113. if (groupname == NotificationGroup.GroupName) {
  114. $('#' + containerid).modal('hide');
  115. $('#' + containerid).remove();
  116. Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(Unibase.Platform.Automation.Components.RuleProvider.installedappid, null);
  117. return;
  118. }
  119. var object = new Unibase.Platform.Automation.Requests.NotificationGroup();
  120. object.NotificationGroupId = Number($('.hd_notificatiobgroupid').val());
  121. object.NotificationGroupName = groupname.toString();
  122. object.Index = Number($('#txt_GrpIndex').val());
  123. Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().saveNotificationGroup(object).then(function (response) {
  124. if (response.status == Unibase.Data.Status.Success) {
  125. MessageHelper.Instance().showSuccess(response.message, "Validate_NotificationGroup");
  126. $('#' + containerid).modal('hide');
  127. $('#' + containerid).remove();
  128. if (NotificationGroup.IsAction) {
  129. Unibase.Platform.Automation.Components.NotificationGroup.Instance().LoadNotificationGroups();
  130. }
  131. else {
  132. Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(Unibase.Platform.Automation.Components.RuleProvider.installedappid, null);
  133. }
  134. }
  135. else {
  136. MessageHelper.Instance().showError(response.message, "Validate_NotificationGroup");
  137. }
  138. });
  139. }
  140. LoadNotificationGroups() {
  141. return __awaiter(this, void 0, void 0, function* () {
  142. yield Unibase.Platform.Automation.Managers.NotificationGroupManager.Instance().GetNotificationGroups().then(function (response) {
  143. if (response != null) {
  144. var html = '<option value="0">Select GroupName</option>';
  145. for (let i = 0; i < response.length; i++) {
  146. html += '<option value=' + response[i].NotificationGroupId + '>' + response[i].NotificationGroupName + '</option>';
  147. }
  148. $('#ddl_NotificationGrp').html(html);
  149. }
  150. });
  151. });
  152. }
  153. static Instance() {
  154. if (this.instance == undefined) {
  155. this.instance = new NotificationGroup();
  156. }
  157. return this.instance;
  158. }
  159. }
  160. NotificationGroup.GroupName = null;
  161. NotificationGroup.IsAction = false;
  162. Components.NotificationGroup = NotificationGroup;
  163. })(Components = Automation.Components || (Automation.Components = {}));
  164. })(Automation = Platform.Automation || (Platform.Automation = {}));
  165. })(Platform = Unibase.Platform || (Unibase.Platform = {}));
  166. })(Unibase || (Unibase = {}));