//field managment
function selDestinationField()
{
var target = event.target;
$('#autocreate_' + $(target).attr('id')).hide();
var selectedOption = target.options[target.selectedIndex]
if($(selectedOption).attr('autoCreate')!==undefined)
$('#autocreate_' + $(target).attr('id')).show();
const allFilled = $('.selDestinationField').toArray().every(function(select) {
const val = $(select).val();
return val !== null && val !== '';
});
if (allFilled) {
$('#btnImportData').removeClass('disabled');
} else {
$('#btnImportData').addClass('disabled');
}
}
function btnCreateField()
{
$('.dCreateField').toggle();
}
function btnEditField()
{
var target = event.target;
if($(target).attr('path')==undefined)
target = $(target).parent();
if($(target).attr('path')!=undefined)
{
bootBoxAdmin('Edit field','/field/modField.php?' + $(target).attr('path'), 'btnTrUpdateField()', );
}
}
function btnTrCreateField()
{
var sErr='';
if($('#FLD_CH_LABEL').val()=='')
sErr += 'Field name is required
';
if($('#FTY_N_ID').val()=='null')
sErr += 'Field type is required
';
if(sErr!='')
bootbox.alert(sErr)
else
$('#frmCreateField').submit()
}
function btnTrUpdateField()
{
var sErr='';
if($('#FLD_CH_LABELupdate').val()=='')
sErr += 'Field name is required
';
if($('#FTY_N_ID').val()=='null')
sErr += 'Field type is required
';
if(sErr!='')
bootbox.alert(sErr)
else
$('#frmUpdateField').submit()
}
function orderField(sTableId, sDatabaseId)
{
$("#tField").tableDnD({
dragHandle: '.dragHandle',
onDragClass: 'bg-success',
onDrop: function(table, row) {
var sId = row.id;
for (var j=0; j
|\/@])/g,'\\$1')).hide();
$('.fldStruct' + unescape( $(target).attr('sFieldId')).replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1')).hide();
}
});
}
function switchHideFieldFromList()
{
var target = event.target;
//console.log($(target).attr('sFieldId'));
$('.fld' + unescape( $(target).attr('sFieldId')).replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1')).hide();
updDiv('#dDumy','/field/trSwitchHideFieldFromList.php?' + $(target).attr('path'));
}
function switchSearchCriteria()
{
var target = event.target;
//console.log($(target).attr('sFieldId'));
//$('.fld' + unescape( $(target).attr('sFieldId')).replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1')).hide();
updDiv('#dDumy','/field/trSwitchSearchCriteria.php?' + $(target).attr('path'));
}
function dFieldSubType()
{
console.log('#1')
var sDropDownId = $(this).attr('id');
var sDivTarget = $('#' + sDropDownId ).nextAll('.dFieldSubType').attr('id')
updDiv( '#' + sDivTarget,'/field/dFieldSubType.php?sExtId=' + encodeURIComponent($(this).attr('id')) + '&sFieldType=' + encodeURIComponent($(this).val()) + '&sDatabaseId=' + encodeURIComponent(getURLParameterByName('sDatabaseId')))
}
function dropDownTableId()
{
console.log('#2')
var sDropDownId = $(this).attr('id');
console.log('sDropDownId:' + sDropDownId);
var sDivTarget = $('#' + sDropDownId ).closest('.dFieldSubType').nextAll('.dFieldSubTypeAttr').attr('id')
console.log('dFieldSubTypeAttr:' +sDivTarget );
$('#' + $(this).parent().attr('fieldlabel')).val($(this).children(':selected').text())
updDiv( '#' + sDivTarget ,'/field/dropDownTableField.php?sExtId=' + encodeURIComponent($(this).attr('id')) + '&' + $(this).val()+ '&fieldlabel=' + encodeURIComponent($(this).parent().attr('fieldlabel')));
}
function dropDownFieldId()
{
//
}