123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class TimePicker {
- init(formpropertyid, prop, callback) {
- var instance = TimePicker.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- var formid = $("#time_" + prop.DocPropertyName).parents('.formValidate').attr('id');
- var errormsg = $("#" + formid).find('.bizgaze_FormErrorMessages').attr('id');
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var requiredClass = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.IncludedStages != null && prop.IncludedStages != "") {
- var StagesForRequired = prop.IncludedStages.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- requiredClass = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- if (prop.ExcludedStages != null && prop.ExcludedStages != "") {
- var ExcludedStages = prop.ExcludedStages.split('|');
- Isrequired = ExcludedStages.find(x => x == CurrentStageId) ? 'hidden' : '';
- requiredClass = ExcludedStages.find(x => x == CurrentStageId) ? '' : 'required';
- reqMark = ExcludedStages.find(x => x == CurrentStageId) ? '' : '*';
- }
- let ControlId = 'txt_' + prop.DocPropertyId;
- if (prop.IsRequired)
- requiredClass = 'required';
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- let html = '<div class="floating-label-form-group floating-label-form-group-with-value">' +
- '<label for="lbl" id="lbl_' + prop.ControlId + '">' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyId + '"> *</span></label>' +
- '<div class="input-group">' +
- '<input type="time" id = "time_' + prop.DocPropertyName + '" class="type-control form-control value-control ' + requiredClass + '" data - propdoctypename="${prop.DocTypeName}" data-regularexp="' + regExpr + '" data - validatemsg="' + ErrMsg + '" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + reqMark + '" /> ' +
- '<input type="hidden" id="hfId" value=""><label for="Validation" id="lblValidation_"' + prop.DocPropertyName + '"></label><input type="hidden" id="hfFormPropertyId" value="" /></div>' + helpTextHtml + '</div>';
- $("#" + containerid).append(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var time = propval.split(" ");
- let timeVal = time[1];
- let meridiem = time[2];
- if (typeof meridiem != "undefined") {
- let [hours, minutes] = timeVal.split(':');
- let formattedTime = "";
- if (meridiem == 'PM') {
- if (hours === '12') {
- hours = '00';
- }
- hours = parseInt(hours, 10) + 12;
- formattedTime = `${hours}:${minutes}`;
- time[1] = formattedTime;
- }
- else if (hours.length == 1) {
- hours = "0" + hours;
- formattedTime = `${hours}:${minutes}`;
- time[1] = formattedTime;
- }
- }
- $("#time_" + DocPropertyName).val(time[1]);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new TimePicker();
- }
- return this.instance;
- }
- }
- Controls.TimePicker = TimePicker;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
|