.pragma library

function firstConf(tabs)
{
    let pyqcrm_conf = {};

    pyqcrm_conf[tabs.name] = {}
    for (var i = 0; i < tabs.children.length; i++)
    {
        if (tabs.children[i].name)
        {
            if (!tabs.children[i].text.trim())
            return false
            if (pyqcrm_conf[tabs.name][tabs.children[i].name] !== "DB_PASS")
                pyqcrm_conf[tabs.name] [tabs.children[i].name] = tabs.children[i].text.trim()
            else
                pyqcrm_conf[tabs.name] [tabs.children[i].name] = tabs.children[i].text
        }
    }

    return pyqcrm_conf
}

function addBusiness(form)
{
    let business_form = {};
    for (var i = 0; i < form.children.length; i++)
    {
        if (form.children[i].toString().startsWith("Combo"))
        {
            if(form.children[i].editText)
            {
                business_form[form.children[i].name] = form.children[i].editText
            }
            else
            {
                business_form[form.children[i].name] = form.children[i].currentText
            }
        }
        else if (form.children[i].toString().startsWith("TextField"))
        {
            business_form[form.children[i].name] = form.children[i].text.trim()
        }
        else if (form.children[i].toString().startsWith("Scroll"))
        {
            business_form[form.children[i].contentChildren[0].name] = form.children[i].contentChildren[0].text.trim()
        }
    }
    return business_form
}



