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.

selfdeclaration.js 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Crm;
  6. (function (Crm) {
  7. let Components;
  8. (function (Components) {
  9. class SelfDeclaration extends Unibase.Platform.Core.BaseComponent {
  10. constructor() {
  11. super(...arguments);
  12. this._dateTimeHelper = Unibase.Platform.Helpers.DateTimeHelper.Instance();
  13. }
  14. jsFiles() {
  15. return ["platform/forms/components/formviewer/formviewer.js", 'libs/parsley/parsley.min.js'];
  16. }
  17. cssFiles() {
  18. return [];
  19. }
  20. html() {
  21. var html = '';
  22. return html;
  23. }
  24. loadhtml(Containerid) {
  25. var html = '<form data-validate="parsley" data-isdynamic="false"><div class="card"><div class="card-header"><h3 class="text-center" style ="color:deepskyblue"><u>Self - Declaration</u></h3 ></div><div style="overflow-x:hidden;" class="d modal-body bg-light"><div class="bg-white mb-10"><div id="bizgaze_CreateErrorMessages" class="clear"></div><div class="col-md-12" style ="height:300px; border:1px solid pink"><h4><p>I, <b><span id="userName1"></span></b> on behalf of <b><span id="lblDistributorName1"></span></b> hereby, declare that <b><span id="lblDistributorName2"></span></b> has utilized DMS system to conduct all Mobil related business transactions accurately, completely and in a timely manner for the month of <b><span id="MonthAndYear1"></span></b>, and the transactional data pertaining to purchase, inventory, sales and market collections (payments received from customers) for the month of <b><span id="MonthAndYear2"></span></b> is accurate as per my knowledge.<br/><br/><br/> Name: <b><span id="userName2"></span></b><br/> Date: <b><span id="CurrentDate"></span></b><br/><br/></p></h4><span><b><input type="checkbox" style ="width:30px;height:14px;" id="isSelfDeclared"> <span></span> Yes, I declare <span id="DeclarationMonthI_e_PreviousMonth" class="hidden"></span> <br/><br/></span><div class="text-center"><input type="button" class="btn btn-primary btn-md" id="btnSubmit" value="Submit" disabled /></div></div></div></div></form>';
  26. $("." + Containerid).html(html);
  27. }
  28. load(Containerid) {
  29. }
  30. init(Containerid) {
  31. let instance = this;
  32. var jsfiles = ["platform/forms/components/formviewer/formviewer.js", 'libs/parsley/parsley.min.js'];
  33. SelfDeclaration.Instance().fileCacheHelper.loadJsFiles(jsfiles, function () {
  34. SelfDeclaration.Instance().loadhtml(Containerid);
  35. $("#btn_Close").click(function () {
  36. SelfDeclaration.Instance().navigationHelper.closePopUp();
  37. });
  38. var tenantname = "";
  39. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/contacts/managers/contactmanager.js", function () {
  40. Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().GetTenants(Number(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().tenantId)).then(function (res) {
  41. if (res.result != null) {
  42. tenantname = res.result.TenantName;
  43. $("#lblDistributorName1").text(tenantname.toString());
  44. $("#lblDistributorName2").text(tenantname.toString());
  45. }
  46. });
  47. });
  48. $("#userName1").text(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().name);
  49. $("#lblDistributorName1").text(tenantname.toString());
  50. $("#lblDistributorName2").text(tenantname.toString());
  51. $("#userName2").text(Unibase.Platform.Membership.Infos.Identity.getCurrentUser().name);
  52. var TotalDate = new Date();
  53. var months = ["JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"];
  54. var date = TotalDate.getDate();
  55. var month = TotalDate.getMonth() + 1;
  56. var year = TotalDate.getFullYear();
  57. if (months[TotalDate.getMonth()] == "DECEMBER") {
  58. year = year - 1;
  59. }
  60. $('#MonthAndYear1').text(months[TotalDate.getMonth()] + "-" + year);
  61. $('#MonthAndYear2').text(months[TotalDate.getMonth()] + "-" + year);
  62. $('#CurrentDate').text(date + "/" + month + "/" + year);
  63. $('#DeclarationMonthI_e_PreviousMonth').text(months[TotalDate.getMonth()]);
  64. var todayDate = new Date($.now());
  65. var serverdate = instance._dateTimeHelper.formatServerDate(todayDate);
  66. var OnlyDate = serverdate.split("/");
  67. if (Number(OnlyDate[2]) >= 1 && Number(OnlyDate[2]) <= 10) {
  68. $("#btnSubmit").prop('disabled', false);
  69. }
  70. else {
  71. $("#btnSubmit").prop('disabled', true);
  72. }
  73. if (Number(OnlyDate[2]) > 10) {
  74. $("#btnSubmit").hide();
  75. $("#isSelfDeclared").hide();
  76. $("#description").hide();
  77. }
  78. SelfDeclaration.Instance().Enable();
  79. $('#btnSubmit').click(function () {
  80. SelfDeclaration.Instance().save();
  81. });
  82. });
  83. }
  84. Enable() {
  85. let instance = this;
  86. var da = new Date($.now());
  87. var date = instance._dateTimeHelper.formatServerDate(da);
  88. date = date.replace('/', '-').replace('/', '-');
  89. var month = $('#DeclarationMonthI_e_PreviousMonth').text();
  90. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/crm/contacts/managers/contactmanager.js", function () {
  91. Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().getSelfDeclarationByDate(date, month).then(function (response) {
  92. if (response.result == "Record not Found") {
  93. $("#btnSubmit").prop("disabled", false);
  94. }
  95. else {
  96. $("#btnSubmit").prop("disabled", true);
  97. $('#btnSubmit').prop('value', 'Submitted');
  98. $("#isSelfDeclared").prop('checked', true);
  99. $("#isSelfDeclared").prop("disabled", true);
  100. }
  101. });
  102. });
  103. }
  104. save() {
  105. var date = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
  106. var IsDeclared = $("#isSelfDeclared").prop('checked');
  107. if (IsDeclared == false) {
  108. MessageHelper.Instance().showError('Please Check Declaration', 'bizgaze_CreateErrorMessages');
  109. return false;
  110. }
  111. var data = {
  112. PciDeclared: IsDeclared,
  113. UserId: Unibase.Platform.Membership.Infos.Identity.getCurrentUser().userId,
  114. DeclarationDate: new Date(),
  115. MonthOfDeclaration: $('#DeclarationMonthI_e_PreviousMonth').text(),
  116. PartitionId: Unibase.Platform.Membership.Infos.Identity.getCurrentUser().partitionId
  117. };
  118. Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().saveSelfDeclaration(data).then(function (response) {
  119. MessageHelper.Instance().showSuccess(response.message, '');
  120. $("#isSelfDeclared").prop('checked', true);
  121. $("#isSelfDeclared").prop("disabled", true);
  122. $('#btnSubmit').prop('value', 'Submitted');
  123. });
  124. }
  125. static Instance() {
  126. if (this.instance === undefined) {
  127. this.instance = new SelfDeclaration();
  128. }
  129. return this.instance;
  130. }
  131. }
  132. Components.SelfDeclaration = SelfDeclaration;
  133. })(Components = Crm.Components || (Crm.Components = {}));
  134. })(Crm = Apps.Crm || (Apps.Crm = {}));
  135. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  136. })(Bizgaze || (Bizgaze = {}));