This commit is contained in:
2023-03-11 17:30:20 +00:00
commit b6c4e025bc
5124 changed files with 1153349 additions and 0 deletions
@@ -0,0 +1,132 @@
var Unibase;
(function (Unibase) {
let Forms;
(function (Forms) {
let Controls;
(function (Controls) {
class CheckBox {
init(formpropertyid, prop, callback) {
var instance = CheckBox.Instance();
instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
if (callback != null)
callback();
}
loadControl(containerid, prop) {
var Isrequired = prop.IsRequired != true ? 'hidden' : '';
var required = prop.IsRequired != true ? '' : 'required';
var reqMark = prop.IsRequired != true ? '' : '*';
var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
var StagesForRequired = prop.StagesForRequired.split('|');
Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
}
const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
var html = `<div id="div_${prop.DocPropertyName}" class="div_${prop.DocPropertyId} form-group floating-label mt-sm-10 mb-0"><br><label for= "lbl" id="lbl_${prop.DocPropertyName}" style="align:center;">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger ${Isrequired}" id="spnIsRequired_${prop.DocPropertyName}">*</span></label>` +
'<input type="hidden" id="hdnchk_' + prop.DocPropertyName + '" class="form-control value-control ' + required + '" data-isdefault="' + prop.IsDefault + '" data-required="' + prop.IsRequired + '" data-regularexp="" data-validatemsg="" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" data-ismultiple="' + prop.IsMultiple + '" value="false" />' +
'<span id="spnChk_' + prop.FormPropertyId + '" data-isswitch="' + prop.IsSwitch + '"></span><input type="hidden" id="hfId" value="false"><label for="Validation" id="lblValidation_' + prop.DocPropertyName + '"></label><input type="hidden" id="hfFormPropertyId" value="" />' + helpTextHtml + '</div>';
$("#" + containerid).html(html);
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/subform/subform.component.js", function () {
Unibase.Forms.Controls.CheckBox.instance.GetDocPropertiesByPropId(containerid, prop.DocPropertyName, prop);
});
}
GetDocPropertiesByPropId(containerid, DocPropertyName, prop) {
var html = "";
var data1 = JSON.parse(prop.ControlJsonText);
var instance = Unibase.Forms.Controls.CheckBox.Instance();
for (var i = 0; i < data1.length; i++) {
var res = data1[i];
if (Unibase.Forms.Controls.SubForm.Instance().Index != undefined && Unibase.Forms.Controls.SubForm.Instance().Index != 0) {
var id = DocPropertyName + '_' + res.ColumnText + Number($("#SubFormIndex").val());
}
else {
var id = DocPropertyName;
if (res.ColumnText != null && res.ColumnText != "") {
id = DocPropertyName + '_' + res.ColumnText;
}
}
if (res.IsSwitch == true) {
if (res.ColumnText == undefined)
res.ColumnText = "";
if (res.IsMultiple == false)
html += '<label id="lblCheckBox_' + DocPropertyName + '" class="lblCheckBox_' + DocPropertyName + ' ' + ' switch m-t pull-right"><input type="checkbox" id="chk_' + DocPropertyName + '" class="type-control chk_' + id + '" name="' + DocPropertyName + '" onclick="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle(' + res.DocPropertyId + ',' + "'" + DocPropertyName + "'" + ')" placeholder = "' + prop.Placeholder + '"/><span></span></label>';
else
html += '<div class="switch m-t"><input type="checkbox" id="chk_' + DocPropertyName + '" class="type-control chk_' + id + '" name="' + DocPropertyName + '" onclick="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle(' + res.DocPropertyId + ',' + "'" + DocPropertyName + "'" + ')" placeholder = "' + prop.Placeholder + '"/><label class="col-sm-6" for="chk_' + id + '">' + res.ColumnText + '</label><span></span>&nbsp</div>';
}
else {
var checkclass = "";
if (res.ColumnText == null || res.ColumnText == "") {
res.ColumnText = "";
checkclass += "pull-right";
}
var onclick = "Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClick('" + DocPropertyName + "'," + res.CheckBoxColumnId + ")";
if (res.IsMultiple == false) {
onclick = "Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle(" + prop.DocPropertyId + ",'" + DocPropertyName + "')";
}
var _subform = $(".btnAddSubForm");
if (_subform.length > 0) {
const Index = Number($(".btnAddSubForm").attr("data-subformcount")) - 1;
html += '<div class="custom-control custom-checkbox divEnablePieces checkbox-primary ' + checkclass + '"><input type="checkbox" class="type-control custom-control-input" id = chk_' + id + '_' + Index + ' name="' + DocPropertyName + '" onclick="' + onclick + '" placeholder = "' + prop.Placeholder + '"><label class="custom-control-label" for = chk_' + id + '_' + Index + '>' + res.ColumnText + '</label><span></span>&nbsp</div>';
}
else {
html += '<div class="custom-control custom-checkbox divEnablePieces checkbox-primary ' + checkclass + '"><input type="checkbox" class="type-control custom-control-input" id = chk_' + id + ' name="' + DocPropertyName + '" onclick="' + onclick + '" placeholder = "' + prop.Placeholder + '"><label class="custom-control-label" for = chk_' + id + '>' + res.ColumnText + '</label><span></span>&nbsp</div>';
}
}
}
$("#" + containerid).find('.div_' + prop.DocPropertyId).find("#spnChk_" + prop.FormPropertyId).html(html);
}
loadControlSettings(controlsettingjson, formpropertyid) {
return null;
}
loadPropertySettings(propertysettings, formpropertyid) {
return null;
}
bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
if (propval == "True") {
$("#chk_" + DocPropertyName).prop("checked", true);
$("#hdnchk_" + DocPropertyName).val("true");
}
}
CheckBoxClick(DocPropertyName, CheckBoxColumnId) {
var ids = $("#hdnchk_" + DocPropertyName).val();
if ($("#chk_" + CheckBoxColumnId).is(':checked')) {
if (ids != "") {
ids += CheckBoxColumnId + "|";
}
else {
ids = CheckBoxColumnId + "|";
}
}
else {
var tg = ids.split('|');
ids = "";
for (var i = 0; i < tg.length; i++) {
var a = tg[i];
if (a != CheckBoxColumnId && tg[i] != '') {
ids += tg[i] + "|";
}
}
}
$("#hdnchk_" + DocPropertyName).val(ids);
}
CheckBoxClickSingle(DocPropertyId, DocPropertyName) {
if ($("#chk_" + DocPropertyName).is(':checked')) {
$("#hdnchk_" + DocPropertyName).val("true");
}
else {
$("#hdnchk_" + DocPropertyName).val("false");
}
}
static Instance() {
if (this.instance === undefined) {
this.instance = new CheckBox();
}
return this.instance;
}
}
Controls.CheckBox = CheckBox;
})(Controls = Forms.Controls || (Forms.Controls = {}));
})(Forms = Unibase.Forms || (Unibase.Forms = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(t){let i;(function(t){class i{init(n,t,r){var u=i.Instance();u.loadControlSettings(t.ControlJsonText,t.FormPropertyId);u.loadPropertySettings(t.PropertySettings,t.FormPropertyId);r!=null&&r()}loadControl(t,i){var f=i.IsRequired!=!0?"hidden":"",e=i.IsRequired!=!0?"":"required",s=i.IsRequired!=!0?"":"*",u=$("#hf_"+$("#hfLayout_InstalledPageId").val()+"_StageId").val(),r,o;i.StagesForRequired!=null&&i.StagesForRequired!=""&&(r=i.StagesForRequired.split("|"),f=r.find(n=>n==u)?"":"hidden",e=r.find(n=>n==u)?"required":"",s=r.find(n=>n==u)?"*":"");const{helpTooltipHtml:h,helpTextHtml:c}=n.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(i);o=`<div id="div_${i.DocPropertyName}" class="div_${i.DocPropertyId} form-group floating-label mt-sm-10 mb-0"><br><label for= "lbl" id="lbl_${i.DocPropertyName}" style="align:center;">${h}<span class="label-name">${i.LabelName}</span><span class="text-danger ${f}" id="spnIsRequired_${i.DocPropertyName}">*</span></label>`+'<input type="hidden" id="hdnchk_'+i.DocPropertyName+'" class="form-control value-control '+e+'" data-isdefault="'+i.IsDefault+'" data-required="'+i.IsRequired+'" data-regularexp="" data-validatemsg="" placeholder = "'+i.Placeholder+'" data-placeholder="'+i.Placeholder+'" data-label="'+i.LabelName+'" data-ismultiple="'+i.IsMultiple+'" value="false" /><span id="spnChk_'+i.FormPropertyId+'" data-isswitch="'+i.IsSwitch+'"><\/span><input type="hidden" id="hfId" value="false"><label for="Validation" id="lblValidation_'+i.DocPropertyName+'"><\/label><input type="hidden" id="hfFormPropertyId" value="" />'+c+"<\/div>";$("#"+t).html(o);n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/subform/subform.component.js",function(){n.Forms.Controls.CheckBox.instance.GetDocPropertiesByPropId(t,i.DocPropertyName,i)})}GetDocPropertiesByPropId(t,i,r){for(var u,f,o,s,l,e="",c=JSON.parse(r.ControlJsonText),a=n.Forms.Controls.CheckBox.Instance(),h=0;h<c.length;h++)if(u=c[h],n.Forms.Controls.SubForm.Instance().Index!=undefined&&n.Forms.Controls.SubForm.Instance().Index!=0?f=i+"_"+u.ColumnText+Number($("#SubFormIndex").val()):(f=i,u.ColumnText!=null&&u.ColumnText!=""&&(f=i+"_"+u.ColumnText)),u.IsSwitch==!0)u.ColumnText==undefined&&(u.ColumnText=""),e+=u.IsMultiple==!1?'<label id="lblCheckBox_'+i+'" class="lblCheckBox_'+i+' switch m-t pull-right"><input type="checkbox" id="chk_'+i+'" class="type-control chk_'+f+'" name="'+i+'" onclick="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle('+u.DocPropertyId+",'"+i+'\')" placeholder = "'+r.Placeholder+'"/><span><\/span><\/label>':'<div class="switch m-t"><input type="checkbox" id="chk_'+i+'" class="type-control chk_'+f+'" name="'+i+'" onclick="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle('+u.DocPropertyId+",'"+i+'\')" placeholder = "'+r.Placeholder+'"/><label class="col-sm-6" for="chk_'+f+'">'+u.ColumnText+"<\/label><span><\/span>&nbsp<\/div>";else if(o="",(u.ColumnText==null||u.ColumnText=="")&&(u.ColumnText="",o+="pull-right"),s="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClick('"+i+"',"+u.CheckBoxColumnId+")",u.IsMultiple==!1&&(s="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle("+r.DocPropertyId+",'"+i+"')"),l=$(".btnAddSubForm"),l.length>0){const n=Number($(".btnAddSubForm").attr("data-subformcount"))-1;e+='<div class="custom-control custom-checkbox divEnablePieces checkbox-primary '+o+'"><input type="checkbox" class="type-control custom-control-input" id = chk_'+f+"_"+n+' name="'+i+'" onclick="'+s+'" placeholder = "'+r.Placeholder+'"><label class="custom-control-label" for = chk_'+f+"_"+n+">"+u.ColumnText+"<\/label><span><\/span>&nbsp<\/div>"}else e+='<div class="custom-control custom-checkbox divEnablePieces checkbox-primary '+o+'"><input type="checkbox" class="type-control custom-control-input" id = chk_'+f+' name="'+i+'" onclick="'+s+'" placeholder = "'+r.Placeholder+'"><label class="custom-control-label" for = chk_'+f+">"+u.ColumnText+"<\/label><span><\/span>&nbsp<\/div>";$("#"+t).find(".div_"+r.DocPropertyId).find("#spnChk_"+r.FormPropertyId).html(e)}loadControlSettings(){return null}loadPropertySettings(){return null}bindEditFormDetails(n,t,i){t=="True"&&($("#chk_"+i).prop("checked",!0),$("#hdnchk_"+i).val("true"))}CheckBoxClick(n,t){var i=$("#hdnchk_"+n).val(),u,r,f;if($("#chk_"+t).is(":checked"))i!=""?i+=t+"|":i=t+"|";else for(u=i.split("|"),i="",r=0;r<u.length;r++)f=u[r],f!=t&&u[r]!=""&&(i+=u[r]+"|");$("#hdnchk_"+n).val(i)}CheckBoxClickSingle(n,t){$("#chk_"+t).is(":checked")?$("#hdnchk_"+t).val("true"):$("#hdnchk_"+t).val("false")}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.CheckBox=i})(i=t.Controls||(t.Controls={}))})(t=n.Forms||(n.Forms={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,153 @@
var Unibase;
(function (Unibase) {
let Forms;
(function (Forms) {
let Controls;
(function (Controls) {
class CheckBox_Settings {
constructor() {
this.Id = 0;
}
loadControlPropertiesHtml(controlpropList, container) {
return ``;
}
bindPropertySettings(prop) {
var propertySettings = prop.PropertySettings;
return "";
}
savePropertySettings(prop) {
var propertySettings = prop.PropertySettings;
return "";
}
loadSettingHtml(Container) {
var html = '<section class="card"><div class="b-b bg-white card-header"><strong class="text-dark Title" id="cpheader">Check Box Setting</strong></div><div class="card-body">' +
'<div class="row"><div class="row col-sm-12"><div id="divChkboxList" class="mt-20 col-sm-6"><div id="divIsmultiple" class=""><label for="frmchkIsDefault" style="margin-top:5px;color:grey"><b>Is Multiple</b></label><label id="lblIsmultiple" style="color:grey" class="switch m-t form-inline pull-right">' +
'<input type="hidden" id="checkboxcolumnId"><input id = "chkIsmultiple" data - group="chkIsmultiple" type = "checkbox" onchange = "Unibase.Forms.Controls.CheckBox_Settings.Instance().IsCheck()" > <span></span></label > </div></div>' +
'<div id="divChkboxswitch" class="mt-20 col-sm-6"><div id="divIsswitch" class=""><label for="frmchkIsswitch" style="margin-top:5px;color:grey"><b>Is Switch</b></label><label id="lblIsswitch" style="color:grey" class="switch m-t form-inline pull-right">' +
'<input type="hidden" id="checkbox_switch"><input id = "chkIsswitch" data - group="chkIsswitch" type = "checkbox"> <span></span></label > </div></div>' +
'<div class="col-sm-12 hidden" id ="divAddOption"><div class="row"><div class="col-sm-12" id="divAddOption"><ul class="list-group list-group-flush radioOptions font-14 m-t-n-md ui-sortable" id="radioOptions"></ul></div></div><div class="row checkbox_addrow"><div class="col-sm-6" id="divRadioList">' +
'<div class="divRadioList"><a href="javascript:" class="btn btn-primary" onclick="Unibase.Platform.Forms.Components.ControlEditor.Instance().AddRadioOptions(0)">Add New Check Box</a>' +
'</div></div></div></div></div></section>';
$(Container).html(html);
if ($("#loadDatatypes option:selected").text() == "String" || $("#loadDatatypes option:selected").text() == "Text") {
$('#chkIsmultiple').prop('checked', true);
$('#chkIsmultiple').addClass('hidden');
$("#divChkboxList").addClass('hidden');
$("#divAddOption").removeClass('hidden');
$(".checkbox_addrow").removeClass("hidden");
Unibase.Platform.Forms.Components.ControlEditor.Instance().AddRadioOptions(0, '', '', '', '', '', '', '');
}
else {
$('#chkIsmultiple').prop('checked', false);
$("#divAddOption").addClass('hidden');
$("#divChkboxList").addClass('hidden');
$(".checkbox_addrow").addClass("hidden");
}
}
bindControlData(controldatajson) {
$("#divAddOption").removeClass('hidden');
if (this.isChecked == true) {
$('#chkIsmultiple').prop('checked', true);
}
else {
$('#chkIsmultiple').prop('checked', false);
}
var response = controldatajson;
var isswitch = response.find(x => x.IsSwitch == true) ? true : false;
if (isswitch == true) {
$('#chkIsswitch').prop('checked', true);
CheckBox_Settings.Instance().Id = response[0].CheckBoxColumnId;
}
var IsMultiple = response.find(x => x.IsMultiple == true) ? true : false;
if (IsMultiple == true) {
$("#radioOptions").empty();
for (var i = 0; i < response.length; i++) {
var data = response[i];
Unibase.Platform.Forms.Components.ControlEditor.Instance().AddRadioOptions(data.CheckBoxColumnId, data.ColumnText, data.ColumnValue, data.ParentDocPropertyName, data.ParentDocPropertyId, data.IndexNumber, data.CheckBoxParentId, data.ParentCheckBoxColumnName);
}
}
}
SaveControlData(controldatajson) {
var arr = [];
var checked;
var IsSwitch;
if ($("#chkIsmultiple").is(':checked')) {
checked = true;
}
else {
checked = false;
}
if ($("#chkIsswitch").is(':checked')) {
IsSwitch = true;
}
else {
IsSwitch = false;
}
if ($("#loadDatatypes option:selected").text().toString() == "Boolean" && checked == false) {
var data = {
CheckBoxColumnId: CheckBox_Settings.Instance().Id,
ColumnText: $(this).find(".rdbText").val(),
ColumnValue: $(this).find(".rdbValue").val(),
DocPropertyId: Number(Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyId),
ControlId: Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlId,
IndexNumber: 0,
IsMultiple: checked,
IsSwitch: IsSwitch,
Datatype: $("#loadDatatypes option:selected").text().toString(),
};
arr.push(data);
}
else {
$(".option-group").each(function () {
var data = {
CheckBoxColumnId: Number($(this).find(".hdnRdbId").val()),
ColumnText: $(this).find(".rdbText").val(),
ColumnValue: $(this).find(".rdbValue").val(),
DocPropertyId: Number(Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyId),
ControlId: Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlId,
IndexNumber: Number($(this).find(".indexno").val()),
IsMultiple: true,
IsSwitch: IsSwitch,
Datatype: $("#loadDatatypes option:selected").text().toString(),
};
arr.push(data);
});
}
controldatajson = JSON.stringify(arr);
return controldatajson;
}
IsCheck() {
if ($("#chkIsmultiple").is(':checked')) {
this.isChecked = true;
$("#divAddOption").removeClass('hidden');
$(".checkbox_addrow").removeClass("hidden");
Unibase.Platform.Forms.Components.ControlEditor.Instance().AddRadioOptions(0, '', '', '', '', '', '', '');
}
else {
this.isChecked = false;
$(".checkbox_addrow").addClass("hidden");
$(".option-group").remove();
$("#divAddOption").addClass('hidden');
}
}
RemoveCheckBoxOption(CheckBoxColumnId, Index) {
if (CheckBoxColumnId != 0) {
Unibase.Platform.Forms.Managers.FormManager.Instance().deleteOptionForControl(CheckBoxColumnId).then(function (response) {
});
}
$("#divCheckBoxOption_" + Index).remove();
$("#radioOptions").find('.option-group').each(function () {
var index = $(this).index() + 1;
$(this).find(".IndexnumberDetails").text(index);
});
}
static Instance() {
if (this._instance === undefined)
this._instance = new CheckBox_Settings();
return this._instance;
}
}
Controls.CheckBox_Settings = CheckBox_Settings;
})(Controls = Forms.Controls || (Forms.Controls = {}));
})(Forms = Unibase.Forms || (Unibase.Forms = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long