123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class Series {
- init(formpropertyid, prop, callback) {
- var instance = Series.Instance();
- var container = "control-container-" + prop.UniqueId;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/series/managers/seriesmanager.js', function () {
- instance.sereisAutoComplete(container, prop).then(function () {
- if (callback != null)
- callback();
- });
- });
- }
- loadControl(containerid, prop) {
- var requiredClass = 'required';
- let ControlId = 'txt_' + prop.FormPropertyId;
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- let html = '<div id="divAutoComplete_' + prop.FormPropertyId + '" class="div_' + prop.DocPropertyName + '" style="border-bottom:0;">' +
- '<label for= "lbl" id = "lbl_' + prop.DocPropertyName + '" >' + prop.LabelName + '<span class="text-danger hide ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyName + '"> *</span></label>' +
- '<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>';
- html += '</div></div>';
- if (prop.ControlJsonText != "" && prop.ControlJsonText != null) {
- var Response = prop;
- var data = JSON.parse(prop.ControlJsonText);
- if (data != null && data != "") {
- html += '<div id="divTxtBox_' + data.FormPropertyId + '" class="hidden"><div class="floating-label-form-group divTxtBox_' + data.FormPropertyId + '" >' +
- '<label for="lbl" id="lbl_' + prop.ControlId + '">Code<span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + data.FormPropertyId + '"> *</span></label>' +
- '<div class="manualseriesvalue"data-id="' + data.FormPropertyId + '">' +
- '<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="">' +
- '<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>' +
- '</div>' +
- '</div></div>';
- }
- }
- $("#" + containerid).html(html);
- if (prop.Value == "0")
- Unibase.Forms.Controls.Series.Instance().EditSeries(prop);
- if (prop.Value != "0")
- $('.divisManualSeries_' + prop.FormPropertyId).addClass("hidden");
- $("#txtSeriesAutoComplete_" + prop.FormPropertyId).change(function () {
- var seriesTypeData = $("#txtSeriesAutoComplete_" + prop.FormPropertyId).select2('data')[0];
- var isManual = seriesTypeData.AddlData;
- if (isManual) {
- $('#divAutoComplete_' + prop.FormPropertyId).addClass("hidden");
- $('#divTxtBox_' + data.FormPropertyId).removeClass("hidden");
- $("#TextSeries_" + data.FormPropertyId).addClass('required');
- var code = $('#hdn_' + data.FormPropertyId).val();
- if (code != null && code != undefined && code != "" && code != "0" && prop.Value != "0") {
- $('#TextSeries_' + data.FormPropertyId).val(code);
- $('#clearManualSeries').addClass("hidden");
- $('#divTxtBox_' + data.FormPropertyId).addClass("floating-label-form-group-with-value");
- }
- }
- else {
- $('#divAutoComplete_' + prop.FormPropertyId).removeClass("hidden");
- $('#divTxtBox_' + data.FormPropertyId).addClass("hidden");
- $('#TextSeries_' + data.FormPropertyId).val("");
- $("#TextSeries_" + data.FormPropertyId).removeClass('required');
- }
- });
- }
- TextSeriesChange(FormPropertyId, SeriesId) {
- if ($('#TextSeries_' + FormPropertyId).val() != "") {
- $('#TextSeries_' + FormPropertyId).removeClass('required');
- var hiddenpropid = $("#control-container-" + FormPropertyId).attr('data-formpropertyid');
- if (hiddenpropid == FormPropertyId) {
- $('#hdn_' + FormPropertyId).val($('#TextSeries_' + FormPropertyId).val());
- $('.txtSeriesAutoComplete_' + SeriesId).removeClass('required');
- }
- }
- }
- clearManualSeries(containerId, codeFormPropertyId, seriesFormPropertyId) {
- $(".txtSeriesAutoComplete_" + seriesFormPropertyId + " option:selected").text('');
- var html = '<option value=""></option>';
- $('.txt_series_autocomplete').append(html);
- $(".txt_series_autocomplete").val("");
- $('#TextSeries_' + codeFormPropertyId).val("");
- $('#divAutoComplete_' + seriesFormPropertyId).removeClass("hidden");
- $('#divTxtBox_' + codeFormPropertyId).addClass("hidden");
- $('#TextSeries_' + codeFormPropertyId).val("");
- $("#TextSeries_" + codeFormPropertyId).removeClass('required');
- }
- EditSeries(prop) {
- if (prop.Value == "0") {
- var data = JSON.parse(prop.ControlJsonText);
- $('#divTxtBox_' + data.FormPropertyId).removeClass("hidden");
- $('#divAutoComplete_' + prop.FormPropertyId).addClass("hidden");
- var Code = $('#hdn_' + data.FormPropertyId).val();
- $('#TextSeries_' + data.FormPropertyId).val(Code);
- $('#divTxtBox_' + data.FormPropertyId).addClass('floating-label-form-group-with-value');
- var html = '<option value="0"></option>';
- $('.txt_series_autocomplete').append(html);
- $(".txt_series_autocomplete").val(0).trigger('change');
- $(".TextManualSeries").prop('disabled', true);
- }
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- $("#txtSeriesAutoComplete_" + formpropertyid).val(propval).trigger('change');
- }
- LoadSeriesAutoComplete(docPropertyName, DocPropertyId, containerid) {
- var FormPropertyId = $('#' + containerid).find(".txtSeriesAutoComplete_" + docPropertyName).parents(".divCustomProperties").data("formpropertyid");
- var installedappid = $("#" + containerid).parents(".formValidate").find("#hf_FormInstalledAppId").val();
- var appkeyid = $("#" + containerid).parents(".formValidate").find("#hf_FormAppKeyId").val();
- var TextId = $('#' + containerid).find("#txtSeriesAutoComplete_" + FormPropertyId);
- var hiddenId = $('#' + containerid).find("#hfSeriesAutoCompleteId_" + FormPropertyId + '_' + docPropertyName);
- }
- sereisAutoComplete(containerid, prop) {
- return __awaiter(this, void 0, void 0, function* () {
- var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
- var Forminstalledappid = Unibase.Platform.Forms.Components.FormViewer.instance.FormInstalledAppId;
- var issubform = $("#" + containerid).attr('data-issubform');
- if (issubform == "true") {
- var subforminstalledappid = $("#" + containerid).parents(".control-group").attr("data-installedappid");
- installedappid = Number(subforminstalledappid);
- }
- else if (installedappid == undefined) {
- var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
- }
- else {
- var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
- }
- var Id = Forminstalledappid;
- if (installedappid == Forminstalledappid || Forminstalledappid == 0) {
- Id = installedappid;
- }
- else {
- Id = Forminstalledappid;
- }
- yield Unibase.Platform.Series.Managers.SeriesManager.Instance().getActiveSeries(0, Id).then(function (response) {
- var controlData = [];
- var count = response.result.length;
- for (let i = 0; i < response.result.length; i++) {
- var controls = response.result[i];
- if (count == 1) {
- controlData.push({ id: controls.SeriesId, text: controls.SeriesName, AddlData: controls.ManualNumbering, selected: true });
- }
- else {
- controlData.push({ id: controls.SeriesId, text: controls.SeriesName, AddlData: controls.ManualNumbering });
- }
- }
- $('.txtSeriesAutoComplete_' + prop.FormPropertyId).select2({
- placeholder: 'Select Control',
- data: controlData,
- theme: "default select2ErrorClass",
- });
- if (prop.Value == null && prop.Value !== "0") {
- $('.divisManualSeries_' + prop.DocPropertyId).removeClass("hidden");
- $('#txtSeriesAutoComplete_' + prop.FormPropertyId).prop('disabled', false);
- }
- else {
- $('.divisManualSeries_' + prop.DocPropertyId).addClass("hidden");
- $('#txtSeriesAutoComplete_' + prop.FormPropertyId).prop('disabled', true);
- }
- });
- });
- }
- static Instance() {
- if (this.instance === undefined)
- this.instance = new Series();
- return this.instance;
- }
- }
- Controls.Series = Series;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
|