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.

offercontact.component.js 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Forms;
  4. (function (Forms) {
  5. let Controls;
  6. (function (Controls) {
  7. class OfferContact extends Unibase.Platform.Core.BaseComponent {
  8. init(formpropertyid, prop, callback) {
  9. var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  10. for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
  11. if (obj.Key === "hf_" + InstalledAppId + "_lobid") {
  12. var LoBId = obj.Value.toString();
  13. }
  14. if (obj.Key === "hf_" + InstalledAppId + "_taggroupid") {
  15. var TagGroupId = obj.Value.toString();
  16. }
  17. }
  18. Unibase.Platform.Forms.Managers.TagManager.Instance().getTagcategoryByuniqueId('Bizgaze_Platform_Crm_Crm_TagCategory_Organizations').then(function (tagres) {
  19. var tagCategoryId = tagres.result.TagCategoryId;
  20. var Parameters = [{ ColumnName: 'TagCategoryId', Value: tagCategoryId }, { ColumnName: 'LobId', Value: LoBId }, { ColumnName: 'TagId', Value: 0 }];
  21. var offerid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_offerid").Value;
  22. Bizgaze.Forms.Controls.OfferContact.Instance().GetTags(offerid, Parameters);
  23. });
  24. $('#btnIncludedTags').click(function () {
  25. Bizgaze.Forms.Controls.OfferContact.Instance().AddTags('section_IncludedTags', 'select2_IncludedTags', 0, LoBId, 0);
  26. });
  27. }
  28. loadControl(containerid, prop) {
  29. var instance = this;
  30. var html = `<div class="row"><input type="hidden" id="hdn_customcontrol" class="value-control" value="Bizgaze.Forms.Controls.OfferContact.Instance().getIncludedTags();"><div class="col-sm-6 floating-label-form-group-with-value" id="IncludedTags"><label for="txt_IncludedTags">Included Tags</label><input type="hidden" class="hf_IncludedTags_" value="" /><select style="width:100%" id="txt_IncludedTags" value="" class="no-border form-control select2_IncludedTags txtIncludedTags" IsTagSelect="false" multiple="multiple"><option value="0">Select</option></select></div><div class="btn-group text-center text-white btn-group-justified mt-30"><a class="btn btn-primary mt-10" id="btnIncludedTags">+</a></div></div>`;
  31. $("#" + containerid).html(html);
  32. var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  33. for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
  34. if (obj.Key === "hf_" + InstalledAppId + "_lobid") {
  35. var LoBId = obj.Value.toString();
  36. }
  37. if (obj.Key === "hf_" + InstalledAppId + "_taggroupid") {
  38. var TagGroupId = obj.Value.toString();
  39. }
  40. }
  41. Unibase.Platform.Forms.Managers.TagManager.Instance().getTagcategoryByuniqueId('Bizgaze_Platform_Crm_Crm_TagCategory_Organizations').then(function (tagres) {
  42. var tagCategoryId = tagres.result.TagCategoryId;
  43. var selectedtags = 'undefined';
  44. var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/autoincludedtags/taggroupid/' + TagGroupId + '/tagcategoryid/' + tagCategoryId + '/includedtags/' + selectedtags + '';
  45. AutoCompleteHelper.getHelper().Create("#txt_IncludedTags", ".hf_IncludedTags_", url, function (response) {
  46. });
  47. });
  48. }
  49. loadControlSettings(controlsettingjson, formpropertyid) {
  50. throw new Error("Method not implemented.");
  51. }
  52. loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
  53. throw new Error("Method not implemented.");
  54. }
  55. bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
  56. var instance = this;
  57. }
  58. AddTags(TagType, control, TagCategoryId, LoBId, Value) {
  59. var len = $('.' + control).length;
  60. var instance = this;
  61. var html = '<div class="row" id="div_' + control + '_' + len + '" class="includedtags""><div class="col-sm-6 mt-10 col-9">' +
  62. '<input type="hidden" id="hdn_customcontrol" class="value-control" value="Bizgaze.Forms.Controls.OfferContact.Instance().getTags();">' +
  63. '<input type="hidden" class="hf_IncludedTags" value="" /><select id=' + control + '_' + len + ' style="width:100%" class="b-a ' + control + ' txt_IncludedTag " value="" multiple="multiple"></select></div>' +
  64. '<div class="mt-20 ml-30"><a href="javascript:;" onclick="Bizgaze.Forms.Controls.OfferContact.Instance().RemoveTags(' + "'" + control + "'" + ',' + len + ')"><i class="fa fa-times"></a></div></div>';
  65. $('.' + TagType).find('.card-body').find('.row:last').after(html);
  66. instance.fileCacheHelper.loadJsFile("platform/tag/managers/tagmanager.js", function () {
  67. var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  68. for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
  69. if (obj.Key === "hf_" + InstalledAppId + "_lobid") {
  70. var LoBId = obj.Value.toString();
  71. }
  72. }
  73. for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
  74. if (obj.Key === "hf_" + InstalledAppId + "_taggroupid") {
  75. var TagGroupId = obj.Value.toString();
  76. }
  77. }
  78. Unibase.Platform.Forms.Managers.TagManager.Instance().getTagcategoryByuniqueId('Bizgaze_Platform_Crm_Crm_TagCategory_Organizations').then(function (tagres) {
  79. var tagCategoryId = tagres.result.TagCategoryId;
  80. var selectedtags = 'undefined';
  81. var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/autoincludedtags/taggroupid/' + TagGroupId + '/tagcategoryid/' + tagCategoryId + '/includedtags/' + selectedtags + '';
  82. AutoCompleteHelper.getHelper().Create(".txt_IncludedTag", ".hf_IncludedTags", url, function (response) {
  83. });
  84. });
  85. });
  86. }
  87. RemoveTags(ctrl, len) {
  88. $('#div_' + ctrl + '_' + len).remove();
  89. }
  90. GetTags(OfferId, Parameters) {
  91. var jsfiles = ['apps/transact/managers/offers/offermanager.js', 'apps/transact/managers/interfaces/offers/ioffermanager.js'];
  92. this.fileCacheHelper.loadJsFiles(jsfiles, function () {
  93. Bizgaze.Apps.Transact.Managers.OfferManager.Instance().getoffer(OfferId).then(function (response) {
  94. var data = response.result;
  95. Bizgaze.Forms.Controls.OfferContact.Instance().ShowTags(data, 'section_IncludedTags', 'select2_IncludedTags', Parameters);
  96. });
  97. });
  98. }
  99. ShowTags(data, TagType, control, Parameters) {
  100. var IncludedTags = data.IncludedTags.split('&');
  101. for (var i = 0; i < IncludedTags.length; i++) {
  102. if (i == 0) {
  103. if (IncludedTags[0] == '|')
  104. IncludedTags[0] = null;
  105. }
  106. else {
  107. Bizgaze.Forms.Controls.OfferContact.Instance().AddTags(TagType, control, Parameters[0].Value, Parameters[1].Value, IncludedTags[i]);
  108. }
  109. }
  110. }
  111. getIncludedTags() {
  112. var includedtags = "|";
  113. var ar = new Array();
  114. $('.select2_IncludedTags').each(function () {
  115. ar.push($(this).val());
  116. for (let i = 0; i < ar[0].length; i++) {
  117. includedtags = includedtags + ar[0][i] + '|';
  118. }
  119. includedtags = includedtags + '&|';
  120. ar = [];
  121. });
  122. var includedtagsids = includedtags.slice(0, includedtags.lastIndexOf("&|") - 1);
  123. return includedtagsids;
  124. }
  125. static Instance() {
  126. if (this._instance === undefined)
  127. this._instance = new OfferContact();
  128. return this._instance;
  129. }
  130. }
  131. Controls.OfferContact = OfferContact;
  132. })(Controls = Forms.Controls || (Forms.Controls = {}));
  133. })(Forms = Bizgaze.Forms || (Bizgaze.Forms = {}));
  134. })(Bizgaze || (Bizgaze = {}));