Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

changeofferstatus.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Transact;
  6. (function (Transact) {
  7. let Components;
  8. (function (Components) {
  9. let Offers;
  10. (function (Offers) {
  11. class ChangeOfferstatus extends Unibase.Platform.Core.BaseComponent {
  12. cssFiles() {
  13. throw new Error("Method not implemented.");
  14. }
  15. jsFiles() {
  16. return ['apps/transact/managers/offers/offermanager.js', 'apps/transact/components/offers/changeofferstatus.js'];
  17. }
  18. html(id, containerid) {
  19. throw new Error("Method not implemented.");
  20. }
  21. load(id, containerid, callback) {
  22. throw new Error("Method not implemented.");
  23. }
  24. init() {
  25. }
  26. changeofferstatus(offerid, statusid) {
  27. var instance = this;
  28. if (statusid == 2)
  29. var msg = "Are you sure you want to De-Activate ?";
  30. else
  31. var msg = "Are you sure you want to Activate ?";
  32. bootbox.confirm({
  33. message: msg,
  34. closeButton: false,
  35. buttons: {
  36. confirm: {
  37. label: 'Yes',
  38. className: 'btn-success'
  39. },
  40. cancel: {
  41. label: 'No',
  42. className: 'btn-danger'
  43. }
  44. },
  45. callback: function (result) {
  46. if (result) {
  47. var Status = "";
  48. var Statusid;
  49. if (statusid == 2) {
  50. Status = "Activate";
  51. Statusid = 2;
  52. $("#Id_" + offerid + "").removeClass('text-danger');
  53. $("#Id_" + offerid + "").addClass('text-success');
  54. }
  55. else {
  56. Status = "activate";
  57. Statusid = 1;
  58. $("#Id_" + offerid + "").removeClass('text-success');
  59. $("#Id_" + offerid + "").addClass('text-danger');
  60. }
  61. var _recordId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_recordid").Value);
  62. var postdata = {
  63. offerid,
  64. Statusid,
  65. };
  66. instance.fileCacheHelper.loadJsFile('apps/transact/managers/offers/offermanager.js', function () {
  67. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().ChangeOfferStatus(postdata).then(function (response) {
  68. if (response.status == Unibase.Data.Status.Success) {
  69. var obj = Unibase.Themes.Compact.Components.Details.Instance();
  70. obj._recordId = _recordId;
  71. var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  72. var containerid = $("._bizgaze_detail_container:visible").attr("id");
  73. Unibase.Platform.Helpers.NavigationHelper.Instance().close(containerid, null);
  74. instance.navigationHelper.loadDetail(_recordId, _installedAppId, null);
  75. MessageHelper.Instance().showSuccess(response.message, "");
  76. }
  77. else {
  78. }
  79. });
  80. });
  81. }
  82. }
  83. });
  84. }
  85. gettabscheme(planid, actualvalue, tabpercent, target, incidentpercent, incidents) {
  86. var instance = this;
  87. instance.fileCacheHelper.loadJsFile('apps/transact/managers/offers/offermanager.js', function () {
  88. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().gettabsachemedata(planid).then(function (response) {
  89. var amount = response.result;
  90. var amt = (amount / 100000).toFixed(3);
  91. $(actualvalue).val(amt);
  92. $(actualvalue).attr("disabled", "disabled");
  93. $(tabpercent).change(function () {
  94. var tabpercentage = Number($(tabpercent).val());
  95. var targetvalue = ((amount * (tabpercentage / 100)) / 100000).toFixed(3);
  96. var targetamount = Number(targetvalue);
  97. $(target).val(targetvalue);
  98. $(target).attr("disabled", "disabled");
  99. $(incidentpercent).change(function () {
  100. var incidentpercentagevalue = Number($(incidentpercent).val());
  101. var incidensvalue = (targetamount * (incidentpercentagevalue / 100)).toFixed(3);
  102. $(incidents).val(incidensvalue);
  103. $(incidents).attr("disabled", "disabled");
  104. });
  105. });
  106. });
  107. });
  108. }
  109. changeplanstatus(containerid) {
  110. var instance = this;
  111. var postdata = [];
  112. $(`#${containerid}`).find(".Offer_Plan_Checked").each(function () {
  113. postdata.push({
  114. OfferId: Number($(this).attr("id")),
  115. PlanId: Number($(this).attr("value")),
  116. Planstatus: $(this).is(":checked"),
  117. });
  118. });
  119. instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () {
  120. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().changeplanstatus(postdata).then(function (response) {
  121. if (response.errors == null) {
  122. MessageHelper.Instance().showSuccess(response.message, 'Plan Status Updated Successfully');
  123. }
  124. else {
  125. MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed');
  126. }
  127. });
  128. });
  129. }
  130. ActiveAllPlans() {
  131. var instance = this;
  132. var postdata = [];
  133. $(".Offer_Plan_Checked").each(function () {
  134. postdata.push({
  135. OfferId: Number($(this).attr("id")),
  136. PlanId: Number($(this).attr("value")),
  137. Planstatus: 1,
  138. });
  139. });
  140. if (postdata.length > 0) {
  141. bootbox.confirm("Are you sure you want Activate All Plans ?", function (result) {
  142. if (result == true) {
  143. instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () {
  144. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().changeplanstatus(postdata).then(function (response) {
  145. if (response.errors == null) {
  146. var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
  147. Unibase.Themes.Compact.Components.Details.Instance().loadPortlets(detail_instance);
  148. MessageHelper.Instance().showSuccess(response.message, 'Plan Status Updated Successfully');
  149. }
  150. else {
  151. MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed');
  152. }
  153. });
  154. });
  155. }
  156. });
  157. }
  158. }
  159. InactiveAllPlans() {
  160. var instance = this;
  161. var postdata = [];
  162. $(".Offer_Plan_Checked").each(function () {
  163. postdata.push({
  164. OfferId: Number($(this).attr("id")),
  165. PlanId: Number($(this).attr("value")),
  166. Planstatus: 2,
  167. });
  168. });
  169. if (postdata.length > 0) {
  170. bootbox.confirm("Are you sure you want In-Active All Plans ?", function (result) {
  171. if (result == true) {
  172. instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () {
  173. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().changeplanstatus(postdata).then(function (response) {
  174. if (response.errors == null) {
  175. var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
  176. Unibase.Themes.Compact.Components.Details.Instance().loadPortlets(detail_instance);
  177. MessageHelper.Instance().showSuccess(response.message, 'Plan Status Updated Successfully');
  178. }
  179. else {
  180. MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed');
  181. }
  182. });
  183. });
  184. }
  185. });
  186. }
  187. }
  188. updateplanstatus(planid) {
  189. var instance = this;
  190. instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () {
  191. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().updateplanstatus(planid).then(function (response) {
  192. if (response.errors == null) {
  193. MessageHelper.Instance().showSuccess(response.message, '');
  194. }
  195. else {
  196. MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed');
  197. }
  198. });
  199. });
  200. }
  201. static Instance() {
  202. if (this._instance === undefined)
  203. this._instance = new ChangeOfferstatus();
  204. return this._instance;
  205. }
  206. }
  207. Offers.ChangeOfferstatus = ChangeOfferstatus;
  208. })(Offers = Components.Offers || (Components.Offers = {}));
  209. })(Components = Transact.Components || (Transact.Components = {}));
  210. })(Transact = Apps.Transact || (Apps.Transact = {}));
  211. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  212. })(Bizgaze || (Bizgaze = {}));