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.

series.component.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 Forms;
  13. (function (Forms) {
  14. let Controls;
  15. (function (Controls) {
  16. class Series {
  17. init(formpropertyid, prop, callback) {
  18. var instance = Series.Instance();
  19. var container = "control-container-" + prop.UniqueId;
  20. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/series/managers/seriesmanager.js', function () {
  21. instance.sereisAutoComplete(container, prop).then(function () {
  22. if (callback != null)
  23. callback();
  24. });
  25. });
  26. }
  27. loadControl(containerid, prop) {
  28. var requiredClass = 'required';
  29. let ControlId = 'txt_' + prop.FormPropertyId;
  30. var Isrequired = prop.IsRequired != true ? 'hidden' : '';
  31. var required = prop.IsRequired != true ? '' : 'required';
  32. let html = '<div id="divAutoComplete_' + prop.FormPropertyId + '" class="div_' + prop.DocPropertyName + '" style="border-bottom:0;">' +
  33. '<label for= "lbl" id = "lbl_' + prop.DocPropertyName + '" >' + prop.LabelName + '<span class="text-danger hide ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyName + '"> *</span></label>' +
  34. '<div class="input-group"><select id="txtSeriesAutoComplete_' + prop.FormPropertyId + '" class="txt_series_autocomplete txtSeriesAutoComplete_' + prop.FormPropertyId + ' value-control txtSeriesAutoComplete_' + prop.DocPropertyName + ' form-control text-control ' + required + '" data-isdefault="' + prop.IsDefault + '" style="width:100%;" placeholder = "' + prop.Placeholder + '" data-required="' + prop.IsRequired + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" ><option value="">-- Select --</option></select>';
  35. html += '</div></div>';
  36. if (prop.ControlJsonText != "" && prop.ControlJsonText != null) {
  37. var Response = prop;
  38. var data = JSON.parse(prop.ControlJsonText);
  39. if (data != null && data != "") {
  40. html += '<div id="divTxtBox_' + data.FormPropertyId + '" class="hidden"><div class="floating-label-form-group divTxtBox_' + data.FormPropertyId + '" >' +
  41. '<label for="lbl" id="lbl_' + prop.ControlId + '">Code<span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + data.FormPropertyId + '"> *</span></label>' +
  42. '<div class="manualseriesvalue"data-id="' + data.FormPropertyId + '">' +
  43. '<input type="text" onchange ="Unibase.Forms.Controls.Series.Instance().TextSeriesChange(' + data.FormPropertyId + ',' + prop.FormPropertyId + ');" id="TextSeries_' + data.FormPropertyId + '"" class="TextManualSeries form-control floating-label-control" placeholder="Enter Manual Series" data-placeholder="Enter Manual Series" data-label=Code data-regularexp="" data-validatemsg="">' +
  44. '<input type="hidden" class="manualseriesvalue" id="hfManualseries_' + data.FormPropertyId + '" value="" /><span id="clearManualSeries" onclick="Unibase.Forms.Controls.Series.Instance().clearManualSeries(`' + containerid + '`,' + data.FormPropertyId + ',' + prop.FormPropertyId + ')" class="fa fa-close font-15 mr-10 field-icon"></span>' +
  45. '</div>' +
  46. '</div></div>';
  47. }
  48. }
  49. $("#" + containerid).html(html);
  50. if (prop.Value == "0")
  51. Unibase.Forms.Controls.Series.Instance().EditSeries(prop);
  52. if (prop.Value != "0")
  53. $('.divisManualSeries_' + prop.FormPropertyId).addClass("hidden");
  54. $("#txtSeriesAutoComplete_" + prop.FormPropertyId).change(function () {
  55. var seriesTypeData = $("#txtSeriesAutoComplete_" + prop.FormPropertyId).select2('data')[0];
  56. var isManual = seriesTypeData.AddlData;
  57. if (isManual) {
  58. $('#divAutoComplete_' + prop.FormPropertyId).addClass("hidden");
  59. $('#divTxtBox_' + data.FormPropertyId).removeClass("hidden");
  60. $("#TextSeries_" + data.FormPropertyId).addClass('required');
  61. var code = $('#hdn_' + data.FormPropertyId).val();
  62. if (code != null && code != undefined && code != "" && code != "0" && prop.Value != "0") {
  63. $('#TextSeries_' + data.FormPropertyId).val(code);
  64. $('#clearManualSeries').addClass("hidden");
  65. $('#divTxtBox_' + data.FormPropertyId).addClass("floating-label-form-group-with-value");
  66. }
  67. }
  68. else {
  69. $('#divAutoComplete_' + prop.FormPropertyId).removeClass("hidden");
  70. $('#divTxtBox_' + data.FormPropertyId).addClass("hidden");
  71. $('#TextSeries_' + data.FormPropertyId).val("");
  72. $("#TextSeries_" + data.FormPropertyId).removeClass('required');
  73. }
  74. });
  75. }
  76. TextSeriesChange(FormPropertyId, SeriesId) {
  77. if ($('#TextSeries_' + FormPropertyId).val() != "") {
  78. $('#TextSeries_' + FormPropertyId).removeClass('required');
  79. var hiddenpropid = $("#control-container-" + FormPropertyId).attr('data-formpropertyid');
  80. if (hiddenpropid == FormPropertyId) {
  81. $('#hdn_' + FormPropertyId).val($('#TextSeries_' + FormPropertyId).val());
  82. $('.txtSeriesAutoComplete_' + SeriesId).removeClass('required');
  83. }
  84. }
  85. }
  86. clearManualSeries(containerId, codeFormPropertyId, seriesFormPropertyId) {
  87. $(".txtSeriesAutoComplete_" + seriesFormPropertyId + " option:selected").text('');
  88. var html = '<option value=""></option>';
  89. $('.txt_series_autocomplete').append(html);
  90. $(".txt_series_autocomplete").val("");
  91. $('#TextSeries_' + codeFormPropertyId).val("");
  92. $('#divAutoComplete_' + seriesFormPropertyId).removeClass("hidden");
  93. $('#divTxtBox_' + codeFormPropertyId).addClass("hidden");
  94. $('#TextSeries_' + codeFormPropertyId).val("");
  95. $("#TextSeries_" + codeFormPropertyId).removeClass('required');
  96. }
  97. EditSeries(prop) {
  98. if (prop.Value == "0") {
  99. var data = JSON.parse(prop.ControlJsonText);
  100. $('#divTxtBox_' + data.FormPropertyId).removeClass("hidden");
  101. $('#divAutoComplete_' + prop.FormPropertyId).addClass("hidden");
  102. var Code = $('#hdn_' + data.FormPropertyId).val();
  103. $('#TextSeries_' + data.FormPropertyId).val(Code);
  104. $('#divTxtBox_' + data.FormPropertyId).addClass('floating-label-form-group-with-value');
  105. var html = '<option value="0"></option>';
  106. $('.txt_series_autocomplete').append(html);
  107. $(".txt_series_autocomplete").val(0).trigger('change');
  108. $(".TextManualSeries").prop('disabled', true);
  109. }
  110. }
  111. loadControlSettings(controlsettingjson, formpropertyid) {
  112. return null;
  113. }
  114. loadPropertySettings(propertysettings, formpropertyid) {
  115. return null;
  116. }
  117. bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
  118. $("#txtSeriesAutoComplete_" + formpropertyid).val(propval).trigger('change');
  119. }
  120. LoadSeriesAutoComplete(docPropertyName, DocPropertyId, containerid) {
  121. var FormPropertyId = $('#' + containerid).find(".txtSeriesAutoComplete_" + docPropertyName).parents(".divCustomProperties").data("formpropertyid");
  122. var installedappid = $("#" + containerid).parents(".formValidate").find("#hf_FormInstalledAppId").val();
  123. var appkeyid = $("#" + containerid).parents(".formValidate").find("#hf_FormAppKeyId").val();
  124. var TextId = $('#' + containerid).find("#txtSeriesAutoComplete_" + FormPropertyId);
  125. var hiddenId = $('#' + containerid).find("#hfSeriesAutoCompleteId_" + FormPropertyId + '_' + docPropertyName);
  126. }
  127. sereisAutoComplete(containerid, prop) {
  128. return __awaiter(this, void 0, void 0, function* () {
  129. var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
  130. var Forminstalledappid = Unibase.Platform.Forms.Components.FormViewer.instance.FormInstalledAppId;
  131. var issubform = $("#" + containerid).attr('data-issubform');
  132. if (issubform == "true") {
  133. var subforminstalledappid = $("#" + containerid).parents(".control-group").attr("data-installedappid");
  134. installedappid = Number(subforminstalledappid);
  135. }
  136. else if (installedappid == undefined) {
  137. var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
  138. }
  139. else {
  140. var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
  141. }
  142. var Id = Forminstalledappid;
  143. if (installedappid == Forminstalledappid || Forminstalledappid == 0) {
  144. Id = installedappid;
  145. }
  146. else {
  147. Id = Forminstalledappid;
  148. }
  149. yield Unibase.Platform.Series.Managers.SeriesManager.Instance().getActiveSeries(0, Id).then(function (response) {
  150. var controlData = [];
  151. var count = response.result.length;
  152. for (let i = 0; i < response.result.length; i++) {
  153. var controls = response.result[i];
  154. if (count == 1) {
  155. controlData.push({ id: controls.SeriesId, text: controls.SeriesName, AddlData: controls.ManualNumbering, selected: true });
  156. }
  157. else {
  158. controlData.push({ id: controls.SeriesId, text: controls.SeriesName, AddlData: controls.ManualNumbering });
  159. }
  160. }
  161. $('.txtSeriesAutoComplete_' + prop.FormPropertyId).select2({
  162. placeholder: 'Select Control',
  163. data: controlData,
  164. theme: "default select2ErrorClass",
  165. });
  166. if (prop.Value == null && prop.Value !== "0") {
  167. $('.divisManualSeries_' + prop.DocPropertyId).removeClass("hidden");
  168. $('#txtSeriesAutoComplete_' + prop.FormPropertyId).prop('disabled', false);
  169. }
  170. else {
  171. $('.divisManualSeries_' + prop.DocPropertyId).addClass("hidden");
  172. $('#txtSeriesAutoComplete_' + prop.FormPropertyId).prop('disabled', true);
  173. }
  174. });
  175. });
  176. }
  177. static Instance() {
  178. if (this.instance === undefined)
  179. this.instance = new Series();
  180. return this.instance;
  181. }
  182. }
  183. Controls.Series = Series;
  184. })(Controls = Forms.Controls || (Forms.Controls = {}));
  185. })(Forms = Unibase.Forms || (Unibase.Forms = {}));
  186. })(Unibase || (Unibase = {}));